Tagged the release... again :)
This commit is contained in:
parent
0653b9ec11
commit
5f2415b48f
|
@ -1,7 +1,7 @@
|
|||
dnl --- Package name is first argument to AC_INIT
|
||||
dnl --- Release version is second argument to AC_INIT
|
||||
|
||||
AC_INIT(desmume, [svn])
|
||||
AC_INIT(desmume, [0.9.1])
|
||||
|
||||
dnl -- find target architecture for some os specific libraries
|
||||
AC_CANONICAL_TARGET
|
File diff suppressed because it is too large
Load Diff
|
@ -1,31 +0,0 @@
|
|||
/* Copyright (C) 2006 yopyop
|
||||
yopyop156@ifrance.com
|
||||
yopyop156.ifrance.com
|
||||
|
||||
Copyright 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
|
||||
*/
|
||||
|
||||
#ifndef _RASTERIZE_H_
|
||||
#define _RASTERIZE_H_
|
||||
|
||||
#include "render3D.h"
|
||||
|
||||
extern GPU3DInterface gpu3DRasterize;
|
||||
|
||||
#endif
|
|
@ -1,587 +0,0 @@
|
|||
#include "texcache.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "bits.h"
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
#include "gfx3d.h"
|
||||
#include "NDSSystem.h"
|
||||
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
||||
//#define DEBUG_DUMP_TEXTURE
|
||||
|
||||
//This class represents a number of regions of memory which should be viewed as contiguous
|
||||
class MemSpan
|
||||
{
|
||||
public:
|
||||
static const int MAXSIZE = 8;
|
||||
|
||||
MemSpan()
|
||||
: numItems(0)
|
||||
{}
|
||||
|
||||
int numItems;
|
||||
|
||||
struct Item {
|
||||
u32 start;
|
||||
u32 len;
|
||||
u8* ptr;
|
||||
u32 ofs; //offset within the memspan
|
||||
} items[MAXSIZE];
|
||||
|
||||
int size;
|
||||
|
||||
//this MemSpan shall be considered the first argument to a standard memcmp
|
||||
//the length shall be as specified in this MemSpan, unless you specify otherwise
|
||||
int memcmp(void* buf2, int size=-1)
|
||||
{
|
||||
if(size==-1) size = this->size;
|
||||
size = min(this->size,size);
|
||||
for(int i=0;i<numItems;i++)
|
||||
{
|
||||
Item &item = items[i];
|
||||
int todo = min((int)item.len,size);
|
||||
size -= todo;
|
||||
int temp = ::memcmp(item.ptr,((u8*)buf2)+item.ofs,todo);
|
||||
if(temp) return temp;
|
||||
if(size == 0) break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//dumps the memspan to the specified buffer
|
||||
//you may set size to limit the size to be copied
|
||||
int dump(void* buf, int size=-1)
|
||||
{
|
||||
if(size==-1) size = this->size;
|
||||
size = min(this->size,size);
|
||||
u8* bufptr = (u8*)buf;
|
||||
int done = 0;
|
||||
for(int i=0;i<numItems;i++)
|
||||
{
|
||||
Item item = items[i];
|
||||
int todo = min((int)item.len,size);
|
||||
size -= todo;
|
||||
done += todo;
|
||||
memcpy(bufptr,item.ptr,todo);
|
||||
bufptr += todo;
|
||||
if(size==0) return done;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
};
|
||||
|
||||
//creates a MemSpan in texture memory
|
||||
static MemSpan MemSpan_TexMem(u32 ofs, u32 len)
|
||||
{
|
||||
MemSpan ret;
|
||||
ret.size = len;
|
||||
u32 currofs = 0;
|
||||
while(len) {
|
||||
MemSpan::Item &curr = ret.items[ret.numItems++];
|
||||
curr.start = ofs&0x1FFFF;
|
||||
u32 slot = (ofs>>17)&3; //slots will wrap around
|
||||
curr.len = min(len,0x20000-curr.start);
|
||||
curr.ofs = currofs;
|
||||
len -= curr.len;
|
||||
ofs += curr.len;
|
||||
currofs += curr.len;
|
||||
u8* ptr = ARM9Mem.textureSlotAddr[slot];
|
||||
|
||||
if(ptr == ARM9Mem.blank_memory) {
|
||||
PROGINFO("Tried to reference unmapped texture memory: slot %d\n",slot);
|
||||
}
|
||||
curr.ptr = ptr + curr.start;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//creates a MemSpan in texture palette memory
|
||||
static MemSpan MemSpan_TexPalette(u32 ofs, u32 len)
|
||||
{
|
||||
MemSpan ret;
|
||||
ret.size = len;
|
||||
u32 currofs = 0;
|
||||
while(len) {
|
||||
MemSpan::Item &curr = ret.items[ret.numItems++];
|
||||
curr.start = ofs&0x3FFF;
|
||||
u32 slot = (ofs>>14)&7; //this masks to 8 slots, but there are really only 6
|
||||
if(slot>5) {
|
||||
PROGINFO("Texture palette overruns texture memory. Wrapping at palette slot 0.\n");
|
||||
slot -= 5;
|
||||
}
|
||||
curr.len = min(len,0x4000-curr.start);
|
||||
curr.ofs = currofs;
|
||||
len -= curr.len;
|
||||
ofs += curr.len;
|
||||
//if(len != 0)
|
||||
//here is an actual test case of bank spanning
|
||||
currofs += curr.len;
|
||||
u8* ptr = ARM9Mem.texPalSlot[slot];
|
||||
|
||||
if(ptr == ARM9Mem.blank_memory) {
|
||||
PROGINFO("Tried to reference unmapped texture palette memory: 16k slot #%d\n",slot);
|
||||
}
|
||||
curr.ptr = ptr + curr.start;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
TextureCache texcache[MAX_TEXTURE+1];
|
||||
u32 texcache_start;
|
||||
u32 texcache_stop;
|
||||
u8 TexCache_texMAP[1024*2048*4];
|
||||
|
||||
|
||||
#if defined (DEBUG_DUMP_TEXTURE) && defined (WIN32)
|
||||
#define DO_DEBUG_DUMP_TEXTURE
|
||||
static void DebugDumpTexture(int which)
|
||||
{
|
||||
char fname[100];
|
||||
sprintf(fname,"c:\\dump\\%d.bmp", which);
|
||||
|
||||
NDS_WriteBMP_32bppBuffer(texcache[which].sizeX,texcache[which].sizeY,TexCache_texMAP,fname);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int lastTexture = -1;
|
||||
void TexCache_SetTexture(unsigned int format, unsigned int texpal)
|
||||
{
|
||||
//for each texformat, number of palette entries
|
||||
const int palSizes[] = {0, 32, 4, 16, 256, 0, 8, 0};
|
||||
|
||||
//for each texformat, multiplier from numtexels to numbytes (fixed point 30.2)
|
||||
const int texSizes[] = {0, 4, 1, 2, 4, 1, 4, 8};
|
||||
|
||||
//used to hold a copy of the palette specified for this texture
|
||||
u16 pal[256];
|
||||
|
||||
u32 *dwdst = (u32*)TexCache_texMAP;
|
||||
|
||||
u32 textureMode = (unsigned short)((format>>26)&0x07);
|
||||
unsigned int sizeX=(8 << ((format>>20)&0x07));
|
||||
unsigned int sizeY=(8 << ((format>>23)&0x07));
|
||||
unsigned int imageSize = sizeX*sizeY;
|
||||
|
||||
u8 *adr;
|
||||
|
||||
u32 paletteAddress;
|
||||
|
||||
switch (textureMode)
|
||||
{
|
||||
case TEXMODE_I2:
|
||||
paletteAddress = texpal<<3;
|
||||
break;
|
||||
case TEXMODE_A3I5: //a3i5
|
||||
case TEXMODE_I4: //i4
|
||||
case TEXMODE_I8: //i8
|
||||
case TEXMODE_A5I3: //a5i3
|
||||
case TEXMODE_16BPP: //16bpp
|
||||
case TEXMODE_4X4: //4x4
|
||||
default:
|
||||
paletteAddress = texpal<<4;
|
||||
break;
|
||||
}
|
||||
|
||||
//analyze the texture memory mapping and the specifications of this texture
|
||||
int palSize = palSizes[textureMode];
|
||||
int texSize = (imageSize*texSizes[textureMode])>>2; //shifted because the texSizes multiplier is fixed point
|
||||
MemSpan ms = MemSpan_TexMem((format&0xFFFF)<<3,texSize);
|
||||
MemSpan mspal = MemSpan_TexPalette(paletteAddress,palSize*2);
|
||||
|
||||
//determine the location for 4x4 index data
|
||||
u32 indexBase;
|
||||
if((format & 0xc000) == 0x8000) indexBase = 0x30000;
|
||||
else indexBase = 0x20000;
|
||||
|
||||
u32 indexOffset = (format&0x3FFF)<<2;
|
||||
|
||||
int indexSize = 0;
|
||||
MemSpan msIndex;
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
indexSize = imageSize>>3;
|
||||
msIndex = MemSpan_TexMem(indexOffset+indexBase,indexSize);
|
||||
}
|
||||
|
||||
|
||||
//dump the palette to a temp buffer, so that we don't have to worry about memory mapping.
|
||||
//this isnt such a problem with texture memory, because we read sequentially from it.
|
||||
//however, we read randomly from palette memory, so the mapping is more costly.
|
||||
mspal.dump(pal);
|
||||
|
||||
|
||||
u32 tx=texcache_start;
|
||||
|
||||
//if(false)
|
||||
while (TRUE)
|
||||
{
|
||||
//conditions where we give up and regenerate the texture:
|
||||
if (texcache_stop == tx) break;
|
||||
if (texcache[tx].frm == 0) break;
|
||||
|
||||
//conditions where we reject matches:
|
||||
//when the teximage or texpal params dont match
|
||||
//(this is our key for identifying palettes in the cache)
|
||||
if (texcache[tx].frm != format) goto REJECT;
|
||||
if (texcache[tx].pal != texpal) goto REJECT;
|
||||
|
||||
//the texture matches params, but isnt suspected invalid. accept it.
|
||||
if (!texcache[tx].suspectedInvalid) goto ACCEPT;
|
||||
|
||||
//if we couldnt cache this entire texture due to it being too large, then reject it
|
||||
if (texSize+indexSize > (int)sizeof(texcache[tx].dump.texture)) goto REJECT;
|
||||
|
||||
//when the palettes dont match:
|
||||
//note that we are considering 4x4 textures to have a palette size of 0.
|
||||
//they really have a potentially HUGE palette, too big for us to handle like a normal palette,
|
||||
//so they go through a different system
|
||||
if (mspal.size != 0 && memcmp(texcache[tx].dump.palette,pal,mspal.size)) goto REJECT;
|
||||
|
||||
//when the texture data doesn't match
|
||||
if(ms.memcmp(texcache[tx].dump.texture,sizeof(texcache[tx].dump.texture))) goto REJECT;
|
||||
|
||||
//if the texture is 4x4 then the index data must match
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
if(msIndex.memcmp(texcache[tx].dump.texture + texcache[tx].dump.textureSize,texcache[tx].dump.indexSize)) goto REJECT;
|
||||
}
|
||||
|
||||
|
||||
ACCEPT:
|
||||
texcache[tx].suspectedInvalid = false;
|
||||
if(lastTexture == -1 || (int)tx != lastTexture)
|
||||
{
|
||||
lastTexture = tx;
|
||||
if(TexCache_BindTexture)
|
||||
TexCache_BindTexture(tx);
|
||||
}
|
||||
return;
|
||||
|
||||
REJECT:
|
||||
tx++;
|
||||
if ( tx > MAX_TEXTURE )
|
||||
{
|
||||
texcache_stop=texcache_start;
|
||||
texcache[texcache_stop].frm=0;
|
||||
texcache_start++;
|
||||
if (texcache_start>MAX_TEXTURE)
|
||||
{
|
||||
texcache_start=0;
|
||||
texcache_stop=MAX_TEXTURE<<1;
|
||||
}
|
||||
tx=0;
|
||||
}
|
||||
}
|
||||
|
||||
lastTexture = tx;
|
||||
//glBindTexture(GL_TEXTURE_2D, texcache[tx].id);
|
||||
|
||||
texcache[tx].suspectedInvalid = false;
|
||||
texcache[tx].frm=format;
|
||||
texcache[tx].mode=textureMode;
|
||||
texcache[tx].pal=texpal;
|
||||
texcache[tx].sizeX=sizeX;
|
||||
texcache[tx].sizeY=sizeY;
|
||||
texcache[tx].invSizeX=1.0f/((float)(sizeX));
|
||||
texcache[tx].invSizeY=1.0f/((float)(sizeY));
|
||||
texcache[tx].dump.textureSize = ms.dump(texcache[tx].dump.texture,sizeof(texcache[tx].dump.texture));
|
||||
|
||||
//dump palette data for cache keying
|
||||
if ( palSize )
|
||||
{
|
||||
memcpy(texcache[tx].dump.palette, pal, palSize*2);
|
||||
}
|
||||
//dump 4x4 index data for cache keying
|
||||
texcache[tx].dump.indexSize = 0;
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
texcache[tx].dump.indexSize = min(msIndex.size,(int)sizeof(texcache[tx].dump.texture) - texcache[tx].dump.textureSize);
|
||||
msIndex.dump(texcache[tx].dump.texture+texcache[tx].dump.textureSize,texcache[tx].dump.indexSize);
|
||||
}
|
||||
|
||||
|
||||
//INFO("Texture %03i - format=%08X; pal=%04X (mode %X, width %04i, height %04i)\n",i, texcache[i].frm, texcache[i].pal, texcache[i].mode, sizeX, sizeY);
|
||||
|
||||
//============================================================================ Texture conversion
|
||||
u32 palZeroTransparent = (1-((format>>29)&1))*255; // shash: CONVERT THIS TO A TABLE :)
|
||||
|
||||
switch (texcache[tx].mode)
|
||||
{
|
||||
case TEXMODE_A3I5:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u16 c = pal[*adr&31];
|
||||
u8 alpha = *adr>>5;
|
||||
*dwdst++ = RGB15TO32(c,material_3bit_to_8bit[alpha]);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I2:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u8 bits;
|
||||
u16 c;
|
||||
|
||||
bits = (*adr)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>2)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>4)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>6)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I4:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u8 bits;
|
||||
u16 c;
|
||||
|
||||
bits = (*adr)&0xF;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>4);
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I8:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = pal[*adr];
|
||||
*dwdst++ = RGB15TO32(c,(*adr == 0) ? palZeroTransparent : 255);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TEXMODE_4X4:
|
||||
{
|
||||
//RGB16TO32 is used here because the other conversion macros result in broken interpolation logic
|
||||
|
||||
if(ms.numItems != 1) {
|
||||
PROGINFO("Your 4x4 texture has overrun its texture slot.\n");
|
||||
}
|
||||
//this check isnt necessary since the addressing is tied to the texture data which will also run out:
|
||||
//if(msIndex.numItems != 1) PROGINFO("Your 4x4 texture index has overrun its slot.\n");
|
||||
|
||||
#define PAL4X4(offset) ( *(u16*)( ARM9Mem.texPalSlot[((paletteAddress + (offset)*2)>>14)] + ((paletteAddress + (offset)*2)&0x3FFF) ) )
|
||||
|
||||
u16* slot1;
|
||||
u32* map = (u32*)ms.items[0].ptr;
|
||||
u32 limit = ms.items[0].len<<2;
|
||||
u32 d = 0;
|
||||
if ( (texcache[tx].frm & 0xc000) == 0x8000)
|
||||
// texel are in slot 2
|
||||
slot1=(u16*)&ARM9Mem.textureSlotAddr[1][((texcache[tx].frm & 0x3FFF)<<2)+0x010000];
|
||||
else
|
||||
slot1=(u16*)&ARM9Mem.textureSlotAddr[1][(texcache[tx].frm & 0x3FFF)<<2];
|
||||
|
||||
u16 yTmpSize = (texcache[tx].sizeY>>2);
|
||||
u16 xTmpSize = (texcache[tx].sizeX>>2);
|
||||
|
||||
//this is flagged whenever a 4x4 overruns its slot.
|
||||
//i am guessing we just generate black in that case
|
||||
bool dead = false;
|
||||
|
||||
for (int y = 0; y < yTmpSize; y ++)
|
||||
{
|
||||
u32 tmpPos[4]={(y<<2)*texcache[tx].sizeX,((y<<2)+1)*texcache[tx].sizeX,
|
||||
((y<<2)+2)*texcache[tx].sizeX,((y<<2)+3)*texcache[tx].sizeX};
|
||||
for (int x = 0; x < xTmpSize; x ++, d++)
|
||||
{
|
||||
if(d >= limit)
|
||||
dead = true;
|
||||
|
||||
if(dead) {
|
||||
for (int sy = 0; sy < 4; sy++)
|
||||
{
|
||||
u32 currentPos = (x<<2) + tmpPos[sy];
|
||||
dwdst[currentPos] = dwdst[currentPos+1] = dwdst[currentPos+2] = dwdst[currentPos+3] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 currBlock = map[d];
|
||||
u16 pal1 = slot1[d];
|
||||
u16 pal1offset = (pal1 & 0x3FFF)<<1;
|
||||
u8 mode = pal1>>14;
|
||||
u32 tmp_col[4];
|
||||
|
||||
tmp_col[0]=RGB16TO32(PAL4X4(pal1offset),255);
|
||||
tmp_col[1]=RGB16TO32(PAL4X4(pal1offset+1),255);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
tmp_col[2]=RGB16TO32(PAL4X4(pal1offset+2),255);
|
||||
tmp_col[3]=RGB16TO32(0x7FFF,0);
|
||||
break;
|
||||
case 1:
|
||||
tmp_col[2]=(((tmp_col[0]&0xFF)+(tmp_col[1]&0xff))>>1)|
|
||||
(((tmp_col[0]&(0xFF<<8))+(tmp_col[1]&(0xFF<<8)))>>1)|
|
||||
(((tmp_col[0]&(0xFF<<16))+(tmp_col[1]&(0xFF<<16)))>>1)|
|
||||
(0xff<<24);
|
||||
tmp_col[3]=RGB16TO32(0x7FFF,0);
|
||||
break;
|
||||
case 2:
|
||||
tmp_col[2]=RGB16TO32(PAL4X4(pal1offset+2),255);
|
||||
tmp_col[3]=RGB16TO32(PAL4X4(pal1offset+3),255);
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
u32 red1, red2;
|
||||
u32 green1, green2;
|
||||
u32 blue1, blue2;
|
||||
u16 tmp1, tmp2;
|
||||
|
||||
red1=tmp_col[0]&0xff;
|
||||
green1=(tmp_col[0]>>8)&0xff;
|
||||
blue1=(tmp_col[0]>>16)&0xff;
|
||||
red2=tmp_col[1]&0xff;
|
||||
green2=(tmp_col[1]>>8)&0xff;
|
||||
blue2=(tmp_col[1]>>16)&0xff;
|
||||
|
||||
tmp1=((red1*5+red2*3)>>6)|
|
||||
(((green1*5+green2*3)>>6)<<5)|
|
||||
(((blue1*5+blue2*3)>>6)<<10);
|
||||
tmp2=((red2*5+red1*3)>>6)|
|
||||
(((green2*5+green1*3)>>6)<<5)|
|
||||
(((blue2*5+blue1*3)>>6)<<10);
|
||||
|
||||
tmp_col[2]=RGB16TO32(tmp1,255);
|
||||
tmp_col[3]=RGB16TO32(tmp2,255);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//set all 16 texels
|
||||
for (int sy = 0; sy < 4; sy++)
|
||||
{
|
||||
// Texture offset
|
||||
u32 currentPos = (x<<2) + tmpPos[sy];
|
||||
u8 currRow = (u8)((currBlock>>(sy<<3))&0xFF);
|
||||
|
||||
dwdst[currentPos] = tmp_col[currRow&3];
|
||||
dwdst[currentPos+1] = tmp_col[(currRow>>2)&3];
|
||||
dwdst[currentPos+2] = tmp_col[(currRow>>4)&3];
|
||||
dwdst[currentPos+3] = tmp_col[(currRow>>6)&3];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case TEXMODE_A5I3:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = pal[*adr&0x07];
|
||||
u8 alpha = (*adr>>3);
|
||||
*dwdst++ = RGB15TO32(c,material_5bit_to_8bit[alpha]);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_16BPP:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
u16* map = (u16*)ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = map[x];
|
||||
int alpha = ((c&0x8000)?255:0);
|
||||
*dwdst++ = RGB15TO32(c&0x7FFF,alpha);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(TexCache_BindTextureData != 0)
|
||||
TexCache_BindTextureData(tx,TexCache_texMAP);
|
||||
|
||||
#ifdef DO_DEBUG_DUMP_TEXTURE
|
||||
DebugDumpTexture(tx);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void TexCache_Reset()
|
||||
{
|
||||
memset(texcache,0,sizeof(texcache));
|
||||
|
||||
texcache_start=0;
|
||||
texcache_stop=MAX_TEXTURE<<1;
|
||||
}
|
||||
|
||||
TextureCache* TexCache_Curr()
|
||||
{
|
||||
if(lastTexture == -1)
|
||||
return NULL;
|
||||
else return &texcache[lastTexture];
|
||||
}
|
||||
|
||||
void TexCache_Invalidate()
|
||||
{
|
||||
//well, this is a very blunt instrument.
|
||||
//lets just flag all the textures as invalid.
|
||||
for(int i=0;i<MAX_TEXTURE+1;i++) {
|
||||
texcache[i].suspectedInvalid = true;
|
||||
|
||||
//invalidate all 4x4 textures when texture palettes change mappings
|
||||
//this is necessary because we arent tracking 4x4 texture palettes to look for changes.
|
||||
//Although I concede this is a bit paranoid.. I think the odds of anyone changing 4x4 palette data
|
||||
//without also changing the texture data is pretty much zero.
|
||||
//
|
||||
//TODO - move this to a separate signal: split into TexReconfigureSignal and TexPaletteReconfigureSignal
|
||||
if(texcache[i].mode == TEXMODE_4X4)
|
||||
texcache[i].frm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void (*TexCache_BindTexture)(u32 texnum) = NULL;
|
||||
void (*TexCache_BindTextureData)(u32 texnum, u8* data);
|
|
@ -1,45 +0,0 @@
|
|||
#ifndef _TEXCACHE_H_
|
||||
#define _TEXCACHE_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_TEXTURE 500
|
||||
#ifdef SSE2
|
||||
struct ALIGN(16) TextureCache
|
||||
#else
|
||||
struct ALIGN(8) TextureCache
|
||||
#endif
|
||||
{
|
||||
u32 id;
|
||||
u32 frm;
|
||||
u32 mode;
|
||||
u32 pal;
|
||||
u32 sizeX;
|
||||
u32 sizeY;
|
||||
float invSizeX;
|
||||
float invSizeY;
|
||||
|
||||
struct {
|
||||
int textureSize, indexSize;
|
||||
u8 texture[128*1024]; // 128Kb texture slot
|
||||
u8 palette[256*2];
|
||||
} dump;
|
||||
|
||||
//set if this texture is suspected be invalid due to a vram reconfigure
|
||||
bool suspectedInvalid;
|
||||
|
||||
};
|
||||
|
||||
extern TextureCache texcache[MAX_TEXTURE+1];
|
||||
|
||||
extern void (*TexCache_BindTexture)(u32 texnum);
|
||||
extern void (*TexCache_BindTextureData)(u32 texnum, u8* data);
|
||||
|
||||
void TexCache_Reset();
|
||||
void TexCache_SetTexture(unsigned int format, unsigned int texpal);
|
||||
void TexCache_Invalidate();
|
||||
|
||||
extern u8 TexCache_texMAP[1024*2048*4];
|
||||
TextureCache* TexCache_Curr();
|
||||
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
|
@ -1,73 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ public header file
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_H
|
||||
#define _GDIPLUS_H
|
||||
|
||||
struct IDirectDrawSurface7;
|
||||
|
||||
typedef signed short INT16;
|
||||
typedef unsigned short UINT16;
|
||||
|
||||
#include <pshpack8.h> // set structure packing to 8
|
||||
|
||||
namespace Gdiplus
|
||||
{
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusMem.h"
|
||||
};
|
||||
|
||||
#include "GdiplusBase.h"
|
||||
|
||||
#include "GdiplusEnums.h"
|
||||
#include "GdiplusTypes.h"
|
||||
#include "GdiplusInit.h"
|
||||
#include "GdiplusPixelFormats.h"
|
||||
#include "GdiplusColor.h"
|
||||
#include "GdiplusMetaHeader.h"
|
||||
#include "GdiplusImaging.h"
|
||||
#include "GdiplusColorMatrix.h"
|
||||
|
||||
#include "GdiplusGpStubs.h"
|
||||
#include "GdiplusHeaders.h"
|
||||
|
||||
namespace DllExports
|
||||
{
|
||||
#include "GdiplusFlat.h"
|
||||
};
|
||||
|
||||
|
||||
#include "GdiplusImageAttributes.h"
|
||||
#include "GdiplusMatrix.h"
|
||||
#include "GdiplusBrush.h"
|
||||
#include "GdiplusPen.h"
|
||||
#include "GdiplusStringFormat.h"
|
||||
#include "GdiplusPath.h"
|
||||
#include "GdiplusLineCaps.h"
|
||||
#include "GdiplusMetafile.h"
|
||||
#include "GdiplusGraphics.h"
|
||||
#include "GdiplusCachedBitmap.h"
|
||||
#include "GdiplusRegion.h"
|
||||
#include "GdiplusFontCollection.h"
|
||||
#include "GdiplusFontFamily.h"
|
||||
#include "GdiplusFont.h"
|
||||
#include "GdiplusBitmap.h"
|
||||
#include "GdiplusImageCodec.h"
|
||||
|
||||
}; // namespace Gdiplus
|
||||
|
||||
#include <poppack.h> // pop structure packing back to previous state
|
||||
|
||||
#endif // !_GDIPLUS_HPP
|
Binary file not shown.
|
@ -1,40 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusBase.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ base memory allocation class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSBASE_H
|
||||
#define _GDIPLUSBASE_H
|
||||
|
||||
class GdiplusBase
|
||||
{
|
||||
public:
|
||||
void (operator delete)(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new)(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
void (operator delete[])(void* in_pVoid)
|
||||
{
|
||||
DllExports::GdipFree(in_pVoid);
|
||||
}
|
||||
void* (operator new[])(size_t in_size)
|
||||
{
|
||||
return DllExports::GdipAlloc(in_size);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,925 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusBitmap.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Bitmap class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSBITMAP_H
|
||||
#define _GDIPLUSBITMAP_H
|
||||
|
||||
inline
|
||||
Image::Image(
|
||||
IN const WCHAR* filename,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
nativeImage = NULL;
|
||||
if(useEmbeddedColorManagement)
|
||||
{
|
||||
lastResult = DllExports::GdipLoadImageFromFileICM(
|
||||
filename,
|
||||
&nativeImage
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipLoadImageFromFile(
|
||||
filename,
|
||||
&nativeImage
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
Image::Image(
|
||||
IN IStream* stream,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
nativeImage = NULL;
|
||||
if(useEmbeddedColorManagement)
|
||||
{
|
||||
lastResult = DllExports::GdipLoadImageFromStreamICM(
|
||||
stream,
|
||||
&nativeImage
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipLoadImageFromStream(
|
||||
stream,
|
||||
&nativeImage
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
inline Image*
|
||||
Image::FromFile(
|
||||
IN const WCHAR* filename,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
return new Image(
|
||||
filename,
|
||||
useEmbeddedColorManagement
|
||||
);
|
||||
}
|
||||
|
||||
inline Image*
|
||||
Image::FromStream(
|
||||
IN IStream* stream,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
return new Image(
|
||||
stream,
|
||||
useEmbeddedColorManagement
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
Image::~Image()
|
||||
{
|
||||
DllExports::GdipDisposeImage(nativeImage);
|
||||
}
|
||||
|
||||
inline Image*
|
||||
Image::Clone()
|
||||
{
|
||||
GpImage *cloneimage = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage));
|
||||
|
||||
return new Image(cloneimage, lastResult);
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetEncoderParameterListSize(
|
||||
IN const CLSID* clsidEncoder
|
||||
)
|
||||
{
|
||||
UINT size = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage,
|
||||
clsidEncoder,
|
||||
&size));
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetEncoderParameterList(
|
||||
IN const CLSID* clsidEncoder,
|
||||
IN UINT size,
|
||||
OUT EncoderParameters* buffer
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage,
|
||||
clsidEncoder,
|
||||
size,
|
||||
buffer));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::Save(
|
||||
IN const WCHAR* filename,
|
||||
IN const CLSID* clsidEncoder,
|
||||
IN const EncoderParameters *encoderParams
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSaveImageToFile(nativeImage,
|
||||
filename,
|
||||
clsidEncoder,
|
||||
encoderParams));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::Save(
|
||||
IN IStream* stream,
|
||||
IN const CLSID* clsidEncoder,
|
||||
IN const EncoderParameters *encoderParams
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSaveImageToStream(nativeImage,
|
||||
stream,
|
||||
clsidEncoder,
|
||||
encoderParams));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::SaveAdd(
|
||||
IN const EncoderParameters *encoderParams
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSaveAdd(nativeImage,
|
||||
encoderParams));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::SaveAdd(
|
||||
IN Image* newImage,
|
||||
IN const EncoderParameters *encoderParams
|
||||
)
|
||||
{
|
||||
if ( newImage == NULL )
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
return SetStatus(DllExports::GdipSaveAddImage(nativeImage,
|
||||
newImage->nativeImage,
|
||||
encoderParams));
|
||||
}
|
||||
|
||||
inline ImageType
|
||||
Image::GetType() const
|
||||
{
|
||||
ImageType type = ImageTypeUnknown;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageType(nativeImage, &type));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetPhysicalDimension(
|
||||
OUT SizeF* size
|
||||
)
|
||||
{
|
||||
if (size == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
REAL width, height;
|
||||
Status status;
|
||||
|
||||
status = SetStatus(DllExports::GdipGetImageDimension(nativeImage,
|
||||
&width, &height));
|
||||
|
||||
size->Width = width;
|
||||
size->Height = height;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetBounds(
|
||||
OUT RectF *srcRect,
|
||||
OUT Unit *srcUnit
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetImageBounds(nativeImage,
|
||||
srcRect, srcUnit));
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetWidth()
|
||||
{
|
||||
UINT width = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetHeight()
|
||||
{
|
||||
UINT height = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height));
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Image::GetHorizontalResolution()
|
||||
{
|
||||
REAL resolution = 0.0f;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution));
|
||||
|
||||
return resolution;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Image::GetVerticalResolution()
|
||||
{
|
||||
REAL resolution = 0.0f;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution));
|
||||
|
||||
return resolution;
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetFlags()
|
||||
{
|
||||
UINT flags = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags));
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetRawFormat(OUT GUID *format)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format));
|
||||
}
|
||||
|
||||
inline PixelFormat
|
||||
Image::GetPixelFormat()
|
||||
{
|
||||
PixelFormat format;
|
||||
|
||||
SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format));
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
inline INT
|
||||
Image::GetPaletteSize()
|
||||
{
|
||||
INT size = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetPalette(
|
||||
OUT ColorPalette *palette,
|
||||
IN INT size
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::SetPalette(
|
||||
IN const ColorPalette *palette
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette));
|
||||
}
|
||||
|
||||
inline Image*
|
||||
Image::GetThumbnailImage(
|
||||
IN UINT thumbWidth,
|
||||
IN UINT thumbHeight,
|
||||
IN GetThumbnailImageAbort callback,
|
||||
IN VOID* callbackData
|
||||
)
|
||||
{
|
||||
GpImage *thumbimage = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipGetImageThumbnail(nativeImage,
|
||||
thumbWidth, thumbHeight,
|
||||
&thumbimage,
|
||||
callback, callbackData));
|
||||
|
||||
Image *newImage = new Image(thumbimage, lastResult);
|
||||
|
||||
if (newImage == NULL)
|
||||
{
|
||||
DllExports::GdipDisposeImage(thumbimage);
|
||||
}
|
||||
|
||||
return newImage;
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetFrameDimensionsCount()
|
||||
{
|
||||
UINT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage,
|
||||
&count));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetFrameDimensionsList(
|
||||
OUT GUID* dimensionIDs,
|
||||
IN UINT count
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage,
|
||||
dimensionIDs,
|
||||
count));
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetFrameCount(
|
||||
IN const GUID* dimensionID
|
||||
)
|
||||
{
|
||||
UINT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipImageGetFrameCount(nativeImage,
|
||||
dimensionID,
|
||||
&count));
|
||||
return count;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::SelectActiveFrame(
|
||||
IN const GUID *dimensionID,
|
||||
IN UINT frameIndex
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage,
|
||||
dimensionID,
|
||||
frameIndex));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::RotateFlip(
|
||||
IN RotateFlipType rotateFlipType
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipImageRotateFlip(nativeImage,
|
||||
rotateFlipType));
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetPropertyCount()
|
||||
{
|
||||
UINT numProperty = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetPropertyCount(nativeImage,
|
||||
&numProperty));
|
||||
|
||||
return numProperty;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetPropertyIdList(
|
||||
IN UINT numOfProperty,
|
||||
OUT PROPID* list
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage,
|
||||
numOfProperty, list));
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Image::GetPropertyItemSize(
|
||||
IN PROPID propId
|
||||
)
|
||||
{
|
||||
UINT size = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage,
|
||||
propId,
|
||||
&size));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetPropertyItem(
|
||||
IN PROPID propId,
|
||||
IN UINT propSize,
|
||||
OUT PropertyItem* buffer
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetPropertyItem(nativeImage,
|
||||
propId, propSize, buffer));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetPropertySize(
|
||||
OUT UINT* totalBufferSize,
|
||||
OUT UINT* numProperties
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetPropertySize(nativeImage,
|
||||
totalBufferSize,
|
||||
numProperties));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetAllPropertyItems(
|
||||
IN UINT totalBufferSize,
|
||||
IN UINT numProperties,
|
||||
OUT PropertyItem* allItems
|
||||
)
|
||||
{
|
||||
if (allItems == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage,
|
||||
totalBufferSize,
|
||||
numProperties,
|
||||
allItems));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::RemovePropertyItem(
|
||||
IN PROPID propId
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::SetPropertyItem(
|
||||
IN const PropertyItem* item
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Image::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
inline
|
||||
Image::Image(GpImage *nativeImage, Status status)
|
||||
{
|
||||
SetNativeImage(nativeImage);
|
||||
lastResult = status;
|
||||
}
|
||||
|
||||
inline VOID
|
||||
Image::SetNativeImage(GpImage *nativeImage)
|
||||
{
|
||||
this->nativeImage = nativeImage;
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN const WCHAR *filename,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
if(useEmbeddedColorManagement)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap);
|
||||
}
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN IStream *stream,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
if(useEmbeddedColorManagement)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap);
|
||||
}
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN INT stride,
|
||||
IN PixelFormat format,
|
||||
IN BYTE *scan0
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromScan0(width,
|
||||
height,
|
||||
stride,
|
||||
format,
|
||||
scan0,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN PixelFormat format
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromScan0(width,
|
||||
height,
|
||||
0,
|
||||
format,
|
||||
NULL,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN Graphics* target)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromGraphics(width,
|
||||
height,
|
||||
target->nativeGraphics,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN IDirectDrawSurface7 * surface
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN const BITMAPINFO* gdiBitmapInfo,
|
||||
IN VOID* gdiBitmapData
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo,
|
||||
gdiBitmapData,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN HBITMAP hbm,
|
||||
IN HPALETTE hpal
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN HICON hicon
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
inline
|
||||
Bitmap::Bitmap(
|
||||
IN HINSTANCE hInstance,
|
||||
IN const WCHAR *bitmapName
|
||||
)
|
||||
{
|
||||
GpBitmap *bitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateBitmapFromResource(hInstance,
|
||||
bitmapName,
|
||||
&bitmap);
|
||||
|
||||
SetNativeImage(bitmap);
|
||||
}
|
||||
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromFile(
|
||||
IN const WCHAR *filename,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
return new Bitmap(
|
||||
filename,
|
||||
useEmbeddedColorManagement
|
||||
);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromStream(
|
||||
IN IStream *stream,
|
||||
IN BOOL useEmbeddedColorManagement
|
||||
)
|
||||
{
|
||||
return new Bitmap(
|
||||
stream,
|
||||
useEmbeddedColorManagement
|
||||
);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromDirectDrawSurface7(
|
||||
IN IDirectDrawSurface7* surface
|
||||
)
|
||||
{
|
||||
return new Bitmap(surface);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromBITMAPINFO(
|
||||
IN const BITMAPINFO* gdiBitmapInfo,
|
||||
IN VOID* gdiBitmapData)
|
||||
{
|
||||
return new Bitmap(gdiBitmapInfo, gdiBitmapData);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromHBITMAP(
|
||||
IN HBITMAP hbm,
|
||||
IN HPALETTE hpal
|
||||
)
|
||||
{
|
||||
return new Bitmap(hbm, hpal);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromHICON(
|
||||
IN HICON hicon
|
||||
)
|
||||
{
|
||||
return new Bitmap(hicon);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::FromResource(
|
||||
IN HINSTANCE hInstance,
|
||||
IN const WCHAR *bitmapName)
|
||||
{
|
||||
return new Bitmap(hInstance, bitmapName);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::GetHBITMAP(
|
||||
IN const Color& colorBackground,
|
||||
OUT HBITMAP* hbmReturn
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap(
|
||||
static_cast<GpBitmap*>(nativeImage),
|
||||
hbmReturn,
|
||||
colorBackground.GetValue()));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::GetHICON(
|
||||
OUT HICON* hiconReturn
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCreateHICONFromBitmap(
|
||||
static_cast<GpBitmap*>(nativeImage),
|
||||
hiconReturn));
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::Clone(
|
||||
IN const Rect& rect,
|
||||
IN PixelFormat format
|
||||
)
|
||||
{
|
||||
return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::Clone(
|
||||
IN INT x,
|
||||
IN INT y,
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN PixelFormat format
|
||||
)
|
||||
{
|
||||
GpBitmap* gpdstBitmap = NULL;
|
||||
Bitmap* bitmap;
|
||||
|
||||
lastResult = DllExports::GdipCloneBitmapAreaI(
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
(GpBitmap *)nativeImage,
|
||||
&gpdstBitmap);
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
bitmap = new Bitmap(gpdstBitmap);
|
||||
|
||||
if (bitmap == NULL)
|
||||
{
|
||||
DllExports::GdipDisposeImage(gpdstBitmap);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::Clone(
|
||||
IN const RectF& rect,
|
||||
IN PixelFormat format
|
||||
)
|
||||
{
|
||||
return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
|
||||
}
|
||||
|
||||
inline Bitmap*
|
||||
Bitmap::Clone(
|
||||
IN REAL x,
|
||||
IN REAL y,
|
||||
IN REAL width,
|
||||
IN REAL height,
|
||||
IN PixelFormat format
|
||||
)
|
||||
{
|
||||
GpBitmap* gpdstBitmap = NULL;
|
||||
Bitmap* bitmap;
|
||||
|
||||
SetStatus(DllExports::GdipCloneBitmapArea(
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
(GpBitmap *)nativeImage,
|
||||
&gpdstBitmap));
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
bitmap = new Bitmap(gpdstBitmap);
|
||||
|
||||
if (bitmap == NULL)
|
||||
{
|
||||
DllExports::GdipDisposeImage(gpdstBitmap);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Bitmap::Bitmap(GpBitmap *nativeBitmap)
|
||||
{
|
||||
lastResult = Ok;
|
||||
|
||||
SetNativeImage(nativeBitmap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::LockBits(
|
||||
IN const Rect* rect,
|
||||
IN UINT flags,
|
||||
IN PixelFormat format,
|
||||
OUT BitmapData* lockedBitmapData
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipBitmapLockBits(
|
||||
static_cast<GpBitmap*>(nativeImage),
|
||||
rect,
|
||||
flags,
|
||||
format,
|
||||
lockedBitmapData));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::UnlockBits(
|
||||
IN BitmapData* lockedBitmapData
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipBitmapUnlockBits(
|
||||
static_cast<GpBitmap*>(nativeImage),
|
||||
lockedBitmapData));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::GetPixel(
|
||||
IN INT x,
|
||||
IN INT y,
|
||||
OUT Color *color)
|
||||
{
|
||||
ARGB argb;
|
||||
|
||||
Status status = SetStatus(DllExports::GdipBitmapGetPixel(
|
||||
static_cast<GpBitmap *>(nativeImage),
|
||||
x, y,
|
||||
&argb));
|
||||
|
||||
if (status == Ok)
|
||||
{
|
||||
color->SetValue(argb);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::SetPixel(
|
||||
IN INT x,
|
||||
IN INT y,
|
||||
IN const Color& color)
|
||||
{
|
||||
return SetStatus(DllExports::GdipBitmapSetPixel(
|
||||
static_cast<GpBitmap *>(nativeImage),
|
||||
x, y,
|
||||
color.GetValue()));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Bitmap::SetResolution(
|
||||
IN REAL xdpi,
|
||||
IN REAL ydpi)
|
||||
{
|
||||
return SetStatus(DllExports::GdipBitmapSetResolution(
|
||||
static_cast<GpBitmap *>(nativeImage),
|
||||
xdpi, ydpi));
|
||||
}
|
||||
#endif
|
|
@ -1,840 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusBrush.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Brush class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSBRUSH_H
|
||||
#define _GDIPLUSBRUSH_H
|
||||
|
||||
class GraphicsPath;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Abstract base class for various brush types
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Brush : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
friend class Graphics;
|
||||
|
||||
virtual ~Brush()
|
||||
{
|
||||
DllExports::GdipDeleteBrush(nativeBrush);
|
||||
}
|
||||
|
||||
virtual Brush* Clone() const
|
||||
{
|
||||
GpBrush *brush = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush));
|
||||
|
||||
Brush *newBrush = new Brush(brush, lastResult);
|
||||
|
||||
if (newBrush == NULL)
|
||||
{
|
||||
DllExports::GdipDeleteBrush(brush);
|
||||
}
|
||||
|
||||
return newBrush;
|
||||
}
|
||||
|
||||
BrushType GetType() const
|
||||
{
|
||||
BrushType type = static_cast<BrushType>(-1);
|
||||
|
||||
SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Brush()
|
||||
{
|
||||
SetStatus(NotImplemented);
|
||||
}
|
||||
|
||||
private:
|
||||
Brush(const Brush& brush);
|
||||
Brush& operator=(const Brush& brush);
|
||||
protected:
|
||||
|
||||
Brush(GpBrush* nativeBrush, Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativeBrush(nativeBrush);
|
||||
}
|
||||
|
||||
VOID SetNativeBrush(GpBrush* nativeBrush)
|
||||
{
|
||||
this->nativeBrush = nativeBrush;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
GpBrush* nativeBrush;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Solid Fill Brush Object
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class SolidBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
SolidBrush(IN const Color& color)
|
||||
{
|
||||
GpSolidFill *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateSolidFill(color.GetValue(), &brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
Status GetColor(OUT Color* color) const
|
||||
{
|
||||
ARGB argb;
|
||||
|
||||
if (color == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
SetStatus(DllExports::GdipGetSolidFillColor((GpSolidFill*)nativeBrush,
|
||||
&argb));
|
||||
|
||||
*color = Color(argb);
|
||||
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
Status SetColor(IN const Color& color)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetSolidFillColor((GpSolidFill*)nativeBrush,
|
||||
color.GetValue()));
|
||||
}
|
||||
|
||||
private:
|
||||
SolidBrush(const SolidBrush &);
|
||||
SolidBrush& operator=(const SolidBrush &);
|
||||
|
||||
protected:
|
||||
|
||||
SolidBrush()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Texture Brush Fill Object
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class TextureBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
TextureBrush(IN Image* image,
|
||||
IN WrapMode wrapMode = WrapModeTile)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTexture(
|
||||
image->nativeImage,
|
||||
wrapMode, &texture);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
// When creating a texture brush from a metafile image, the dstRect
|
||||
// is used to specify the size that the metafile image should be
|
||||
// rendered at in the device units of the destination graphics.
|
||||
// It is NOT used to crop the metafile image, so only the width
|
||||
// and height values matter for metafiles.
|
||||
|
||||
TextureBrush(IN Image* image,
|
||||
IN WrapMode wrapMode,
|
||||
IN const RectF &dstRect)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTexture2(
|
||||
image->nativeImage,
|
||||
wrapMode,
|
||||
dstRect.X,
|
||||
dstRect.Y,
|
||||
dstRect.Width,
|
||||
dstRect.Height,
|
||||
&texture);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
TextureBrush(IN Image *image,
|
||||
IN const RectF &dstRect,
|
||||
IN const ImageAttributes *imageAttributes = NULL)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTextureIA(
|
||||
image->nativeImage,
|
||||
(imageAttributes)?imageAttributes->nativeImageAttr:NULL,
|
||||
dstRect.X,
|
||||
dstRect.Y,
|
||||
dstRect.Width,
|
||||
dstRect.Height,
|
||||
&texture
|
||||
);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
TextureBrush(IN Image *image,
|
||||
IN const Rect &dstRect,
|
||||
IN const ImageAttributes *imageAttributes = NULL)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTextureIAI(
|
||||
image->nativeImage,
|
||||
(imageAttributes)?imageAttributes->nativeImageAttr:NULL,
|
||||
dstRect.X,
|
||||
dstRect.Y,
|
||||
dstRect.Width,
|
||||
dstRect.Height,
|
||||
&texture
|
||||
);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
TextureBrush(
|
||||
IN Image* image,
|
||||
IN WrapMode wrapMode,
|
||||
|
||||
const IN Rect &dstRect
|
||||
)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTexture2I(
|
||||
image->nativeImage,
|
||||
wrapMode,
|
||||
dstRect.X,
|
||||
dstRect.Y,
|
||||
dstRect.Width,
|
||||
dstRect.Height,
|
||||
&texture);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
TextureBrush(IN Image* image,
|
||||
IN WrapMode wrapMode,
|
||||
IN REAL dstX,
|
||||
IN REAL dstY,
|
||||
IN REAL dstWidth,
|
||||
IN REAL dstHeight)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTexture2(
|
||||
image->nativeImage,
|
||||
wrapMode,
|
||||
dstX,
|
||||
dstY,
|
||||
dstWidth,
|
||||
dstHeight,
|
||||
&texture);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
TextureBrush(IN Image* image,
|
||||
IN WrapMode wrapMode,
|
||||
IN INT dstX,
|
||||
IN INT dstY,
|
||||
IN INT dstWidth,
|
||||
IN INT dstHeight)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateTexture2I(
|
||||
image->nativeImage,
|
||||
wrapMode,
|
||||
dstX,
|
||||
dstY,
|
||||
dstWidth,
|
||||
dstHeight,
|
||||
&texture);
|
||||
|
||||
SetNativeBrush(texture);
|
||||
}
|
||||
|
||||
Status SetTransform(IN const Matrix* matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetTextureTransform((GpTexture*)nativeBrush,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status GetTransform(OUT Matrix* matrix) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetTextureTransform((GpTexture*)nativeBrush,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status ResetTransform()
|
||||
{
|
||||
return SetStatus(DllExports::GdipResetTextureTransform((GpTexture*)nativeBrush));
|
||||
}
|
||||
|
||||
Status MultiplyTransform(IN const Matrix* matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyTextureTransform((GpTexture*)nativeBrush,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status TranslateTransform(IN REAL dx,
|
||||
IN REAL dy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateTextureTransform((GpTexture*)nativeBrush,
|
||||
dx, dy, order));
|
||||
}
|
||||
|
||||
Status ScaleTransform(IN REAL sx,
|
||||
IN REAL sy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScaleTextureTransform((GpTexture*)nativeBrush,
|
||||
sx, sy, order));
|
||||
}
|
||||
|
||||
Status RotateTransform(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotateTextureTransform((GpTexture*)nativeBrush,
|
||||
angle, order));
|
||||
}
|
||||
|
||||
Status SetWrapMode(IN WrapMode wrapMode)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetTextureWrapMode((GpTexture*)nativeBrush,
|
||||
wrapMode));
|
||||
}
|
||||
|
||||
WrapMode GetWrapMode() const
|
||||
{
|
||||
WrapMode wrapMode;
|
||||
|
||||
SetStatus(DllExports::GdipGetTextureWrapMode((GpTexture*)nativeBrush,
|
||||
&wrapMode));
|
||||
return wrapMode;
|
||||
}
|
||||
|
||||
Image *GetImage() const
|
||||
{
|
||||
GpImage *image;
|
||||
|
||||
SetStatus(DllExports::GdipGetTextureImage((GpTexture *)nativeBrush,
|
||||
&image));
|
||||
|
||||
Image *retimage = new Image(image, lastResult);
|
||||
|
||||
if (retimage == NULL)
|
||||
{
|
||||
DllExports::GdipDisposeImage(image);
|
||||
}
|
||||
|
||||
return retimage;
|
||||
}
|
||||
|
||||
private:
|
||||
TextureBrush(const TextureBrush &);
|
||||
TextureBrush& operator=(const TextureBrush &);
|
||||
|
||||
protected:
|
||||
|
||||
TextureBrush()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Linear Gradient Brush Object
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class LinearGradientBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
LinearGradientBrush(IN const PointF& point1,
|
||||
IN const PointF& point2,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrush(&point1,
|
||||
&point2,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(IN const Point& point1,
|
||||
IN const Point& point2,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrushI(&point1,
|
||||
&point2,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(IN const RectF& rect,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2,
|
||||
IN LinearGradientMode mode)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrushFromRect(&rect,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
mode,
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(IN const Rect& rect,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2,
|
||||
IN LinearGradientMode mode)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrushFromRectI(&rect,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
mode,
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(IN const RectF& rect,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2,
|
||||
IN REAL angle,
|
||||
IN BOOL isAngleScalable = FALSE)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrushFromRectWithAngle(&rect,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
angle,
|
||||
isAngleScalable,
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(IN const Rect& rect,
|
||||
IN const Color& color1,
|
||||
IN const Color& color2,
|
||||
IN REAL angle,
|
||||
IN BOOL isAngleScalable = FALSE)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateLineBrushFromRectWithAngleI(&rect,
|
||||
color1.GetValue(),
|
||||
color2.GetValue(),
|
||||
angle,
|
||||
isAngleScalable,
|
||||
WrapModeTile,
|
||||
&brush);
|
||||
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
Status SetLinearColors(IN const Color& color1,
|
||||
IN const Color& color2)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineColors((GpLineGradient*)nativeBrush,
|
||||
color1.GetValue(),
|
||||
color2.GetValue()));
|
||||
}
|
||||
|
||||
Status GetLinearColors(OUT Color* colors) const
|
||||
{
|
||||
ARGB argb[2];
|
||||
|
||||
if (colors == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
SetStatus(DllExports::GdipGetLineColors((GpLineGradient*) nativeBrush, argb));
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
// use bitwise copy operator for Color copy
|
||||
colors[0] = Color(argb[0]);
|
||||
colors[1] = Color(argb[1]);
|
||||
}
|
||||
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
Status GetRectangle(OUT RectF* rect) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLineRect((GpLineGradient*)nativeBrush, rect));
|
||||
}
|
||||
|
||||
Status GetRectangle(OUT Rect* rect) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect));
|
||||
}
|
||||
|
||||
Status SetGammaCorrection(IN BOOL useGammaCorrection)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineGammaCorrection((GpLineGradient*)nativeBrush,
|
||||
useGammaCorrection));
|
||||
}
|
||||
|
||||
BOOL GetGammaCorrection() const
|
||||
{
|
||||
BOOL useGammaCorrection;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineGammaCorrection((GpLineGradient*)nativeBrush,
|
||||
&useGammaCorrection));
|
||||
|
||||
return useGammaCorrection;
|
||||
}
|
||||
|
||||
INT GetBlendCount() const
|
||||
{
|
||||
INT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineBlendCount((GpLineGradient*)
|
||||
nativeBrush,
|
||||
&count));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Status SetBlend(IN const REAL* blendFactors,
|
||||
IN const REAL* blendPositions,
|
||||
IN INT count)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineBlend((GpLineGradient*)
|
||||
nativeBrush,
|
||||
blendFactors,
|
||||
blendPositions,
|
||||
count));
|
||||
}
|
||||
|
||||
Status GetBlend(OUT REAL* blendFactors,
|
||||
OUT REAL* blendPositions,
|
||||
IN INT count) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLineBlend((GpLineGradient*)nativeBrush,
|
||||
blendFactors,
|
||||
blendPositions,
|
||||
count));
|
||||
}
|
||||
|
||||
INT GetInterpolationColorCount() const
|
||||
{
|
||||
INT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetLinePresetBlendCount((GpLineGradient*)
|
||||
nativeBrush,
|
||||
&count));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Status SetInterpolationColors(IN const Color* presetColors,
|
||||
IN const REAL* blendPositions,
|
||||
IN INT count)
|
||||
{
|
||||
if ((count <= 0) || !presetColors)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
ARGB *argbs = (ARGB*) new BYTE[count*sizeof(ARGB)];
|
||||
|
||||
if (argbs)
|
||||
{
|
||||
for (INT i = 0; i < count; i++)
|
||||
{
|
||||
argbs[i] = presetColors[i].GetValue();
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipSetLinePresetBlend(
|
||||
(GpLineGradient*) nativeBrush,
|
||||
argbs,
|
||||
blendPositions,
|
||||
count));
|
||||
delete [] argbs;
|
||||
return status;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SetStatus(OutOfMemory);
|
||||
}
|
||||
}
|
||||
|
||||
Status GetInterpolationColors(OUT Color* presetColors,
|
||||
OUT REAL* blendPositions,
|
||||
IN INT count) const
|
||||
{
|
||||
if ((count <= 0) || !presetColors)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
ARGB* argbs = (ARGB*) new BYTE[count*sizeof(ARGB)];
|
||||
|
||||
if (!argbs)
|
||||
{
|
||||
return SetStatus(OutOfMemory);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetLinePresetBlend((GpLineGradient*)nativeBrush,
|
||||
argbs,
|
||||
blendPositions,
|
||||
count));
|
||||
if (status == Ok)
|
||||
{
|
||||
for (INT i = 0; i < count; i++)
|
||||
{
|
||||
presetColors[i] = Color(argbs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] argbs;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Status SetBlendBellShape(IN REAL focus,
|
||||
IN REAL scale = 1.0f)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale));
|
||||
}
|
||||
|
||||
Status SetBlendTriangularShape(
|
||||
IN REAL focus,
|
||||
IN REAL scale = 1.0f
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale));
|
||||
}
|
||||
|
||||
Status SetTransform(IN const Matrix* matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineTransform((GpLineGradient*)nativeBrush,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status GetTransform(OUT Matrix *matrix) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLineTransform((GpLineGradient*)nativeBrush,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status ResetTransform()
|
||||
{
|
||||
return SetStatus(DllExports::GdipResetLineTransform((GpLineGradient*)nativeBrush));
|
||||
}
|
||||
|
||||
Status MultiplyTransform(IN const Matrix* matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyLineTransform((GpLineGradient*)nativeBrush,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status TranslateTransform(IN REAL dx,
|
||||
IN REAL dy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateLineTransform((GpLineGradient*)nativeBrush,
|
||||
dx, dy, order));
|
||||
}
|
||||
|
||||
Status ScaleTransform(IN REAL sx,
|
||||
IN REAL sy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScaleLineTransform((GpLineGradient*)nativeBrush,
|
||||
sx, sy, order));
|
||||
}
|
||||
|
||||
Status RotateTransform(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotateLineTransform((GpLineGradient*)nativeBrush,
|
||||
angle, order));
|
||||
}
|
||||
|
||||
Status SetWrapMode(IN WrapMode wrapMode)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetLineWrapMode((GpLineGradient*)nativeBrush,
|
||||
wrapMode));
|
||||
}
|
||||
|
||||
WrapMode GetWrapMode() const
|
||||
{
|
||||
WrapMode wrapMode;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineWrapMode((GpLineGradient*)
|
||||
nativeBrush,
|
||||
&wrapMode));
|
||||
|
||||
return wrapMode;
|
||||
}
|
||||
|
||||
private:
|
||||
LinearGradientBrush(const LinearGradientBrush &);
|
||||
LinearGradientBrush& operator=(const LinearGradientBrush &);
|
||||
|
||||
protected:
|
||||
|
||||
LinearGradientBrush()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PathGradientBrush object is defined
|
||||
// in gdipluspath.h.
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Hatch Brush Object
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class HatchBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
HatchBrush(IN HatchStyle hatchStyle,
|
||||
IN const Color& foreColor,
|
||||
IN const Color& backColor = Color())
|
||||
{
|
||||
GpHatch *brush = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateHatchBrush(hatchStyle,
|
||||
foreColor.GetValue(),
|
||||
backColor.GetValue(),
|
||||
&brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
HatchStyle GetHatchStyle() const
|
||||
{
|
||||
HatchStyle hatchStyle;
|
||||
|
||||
SetStatus(DllExports::GdipGetHatchStyle((GpHatch*)nativeBrush,
|
||||
&hatchStyle));
|
||||
|
||||
return hatchStyle;
|
||||
}
|
||||
|
||||
Status GetForegroundColor(OUT Color* color) const
|
||||
{
|
||||
ARGB argb;
|
||||
|
||||
if (color == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetHatchForegroundColor(
|
||||
(GpHatch*)nativeBrush,
|
||||
&argb));
|
||||
|
||||
color->SetValue(argb);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Status GetBackgroundColor(OUT Color *color) const
|
||||
{
|
||||
ARGB argb;
|
||||
|
||||
if (color == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetHatchBackgroundColor(
|
||||
(GpHatch*)nativeBrush,
|
||||
&argb));
|
||||
|
||||
color->SetValue(argb);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
private:
|
||||
HatchBrush(const HatchBrush &);
|
||||
HatchBrush& operator=(const HatchBrush &);
|
||||
|
||||
protected:
|
||||
|
||||
HatchBrush()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* CachedBitmap class definition
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CachedBitmap is a representation of an accelerated drawing
|
||||
* that has restrictions on what operations are allowed in order
|
||||
* to accelerate the drawing to the destination.
|
||||
*
|
||||
* Look for class definition in GdiplusHeaders.h
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCACHEDBITMAP_H
|
||||
#define _GDIPLUSCACHEDBITMAP_H
|
||||
|
||||
inline
|
||||
CachedBitmap::CachedBitmap(
|
||||
IN Bitmap *bitmap,
|
||||
IN Graphics *graphics)
|
||||
{
|
||||
nativeCachedBitmap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateCachedBitmap(
|
||||
(GpBitmap *)bitmap->nativeImage,
|
||||
graphics->nativeGraphics,
|
||||
&nativeCachedBitmap
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
CachedBitmap::~CachedBitmap()
|
||||
{
|
||||
DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CachedBitmap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,324 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColor.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Object
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLOR_H
|
||||
#define _GDIPLUSCOLOR_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color mode
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMode
|
||||
{
|
||||
ColorModeARGB32 = 0,
|
||||
ColorModeARGB64 = 1
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Channel flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorChannelFlags
|
||||
{
|
||||
ColorChannelFlagsC = 0,
|
||||
ColorChannelFlagsM,
|
||||
ColorChannelFlagsY,
|
||||
ColorChannelFlagsK,
|
||||
ColorChannelFlagsLast
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Color
|
||||
{
|
||||
public:
|
||||
|
||||
Color()
|
||||
{
|
||||
Argb = (ARGB)Color::Black;
|
||||
}
|
||||
|
||||
// Construct an opaque Color object with
|
||||
// the specified Red, Green, Blue values.
|
||||
//
|
||||
// Color values are not premultiplied.
|
||||
|
||||
Color(IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(255, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
Argb = MakeARGB(a, r, g, b);
|
||||
}
|
||||
|
||||
Color(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
BYTE GetAlpha() const
|
||||
{
|
||||
return (BYTE) (Argb >> AlphaShift);
|
||||
}
|
||||
|
||||
BYTE GetA() const
|
||||
{
|
||||
return GetAlpha();
|
||||
}
|
||||
|
||||
BYTE GetRed() const
|
||||
{
|
||||
return (BYTE) (Argb >> RedShift);
|
||||
}
|
||||
|
||||
BYTE GetR() const
|
||||
{
|
||||
return GetRed();
|
||||
}
|
||||
|
||||
BYTE GetGreen() const
|
||||
{
|
||||
return (BYTE) (Argb >> GreenShift);
|
||||
}
|
||||
|
||||
BYTE GetG() const
|
||||
{
|
||||
return GetGreen();
|
||||
}
|
||||
|
||||
BYTE GetBlue() const
|
||||
{
|
||||
return (BYTE) (Argb >> BlueShift);
|
||||
}
|
||||
|
||||
BYTE GetB() const
|
||||
{
|
||||
return GetBlue();
|
||||
}
|
||||
|
||||
ARGB GetValue() const
|
||||
{
|
||||
return Argb;
|
||||
}
|
||||
|
||||
VOID SetValue(IN ARGB argb)
|
||||
{
|
||||
Argb = argb;
|
||||
}
|
||||
|
||||
VOID SetFromCOLORREF(IN COLORREF rgb)
|
||||
{
|
||||
Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb));
|
||||
}
|
||||
|
||||
COLORREF ToCOLORREF() const
|
||||
{
|
||||
return RGB(GetRed(), GetGreen(), GetBlue());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Common color constants
|
||||
|
||||
enum
|
||||
{
|
||||
AliceBlue = 0xFFF0F8FF,
|
||||
AntiqueWhite = 0xFFFAEBD7,
|
||||
Aqua = 0xFF00FFFF,
|
||||
Aquamarine = 0xFF7FFFD4,
|
||||
Azure = 0xFFF0FFFF,
|
||||
Beige = 0xFFF5F5DC,
|
||||
Bisque = 0xFFFFE4C4,
|
||||
Black = 0xFF000000,
|
||||
BlanchedAlmond = 0xFFFFEBCD,
|
||||
Blue = 0xFF0000FF,
|
||||
BlueViolet = 0xFF8A2BE2,
|
||||
Brown = 0xFFA52A2A,
|
||||
BurlyWood = 0xFFDEB887,
|
||||
CadetBlue = 0xFF5F9EA0,
|
||||
Chartreuse = 0xFF7FFF00,
|
||||
Chocolate = 0xFFD2691E,
|
||||
Coral = 0xFFFF7F50,
|
||||
CornflowerBlue = 0xFF6495ED,
|
||||
Cornsilk = 0xFFFFF8DC,
|
||||
Crimson = 0xFFDC143C,
|
||||
Cyan = 0xFF00FFFF,
|
||||
DarkBlue = 0xFF00008B,
|
||||
DarkCyan = 0xFF008B8B,
|
||||
DarkGoldenrod = 0xFFB8860B,
|
||||
DarkGray = 0xFFA9A9A9,
|
||||
DarkGreen = 0xFF006400,
|
||||
DarkKhaki = 0xFFBDB76B,
|
||||
DarkMagenta = 0xFF8B008B,
|
||||
DarkOliveGreen = 0xFF556B2F,
|
||||
DarkOrange = 0xFFFF8C00,
|
||||
DarkOrchid = 0xFF9932CC,
|
||||
DarkRed = 0xFF8B0000,
|
||||
DarkSalmon = 0xFFE9967A,
|
||||
DarkSeaGreen = 0xFF8FBC8B,
|
||||
DarkSlateBlue = 0xFF483D8B,
|
||||
DarkSlateGray = 0xFF2F4F4F,
|
||||
DarkTurquoise = 0xFF00CED1,
|
||||
DarkViolet = 0xFF9400D3,
|
||||
DeepPink = 0xFFFF1493,
|
||||
DeepSkyBlue = 0xFF00BFFF,
|
||||
DimGray = 0xFF696969,
|
||||
DodgerBlue = 0xFF1E90FF,
|
||||
Firebrick = 0xFFB22222,
|
||||
FloralWhite = 0xFFFFFAF0,
|
||||
ForestGreen = 0xFF228B22,
|
||||
Fuchsia = 0xFFFF00FF,
|
||||
Gainsboro = 0xFFDCDCDC,
|
||||
GhostWhite = 0xFFF8F8FF,
|
||||
Gold = 0xFFFFD700,
|
||||
Goldenrod = 0xFFDAA520,
|
||||
Gray = 0xFF808080,
|
||||
Green = 0xFF008000,
|
||||
GreenYellow = 0xFFADFF2F,
|
||||
Honeydew = 0xFFF0FFF0,
|
||||
HotPink = 0xFFFF69B4,
|
||||
IndianRed = 0xFFCD5C5C,
|
||||
Indigo = 0xFF4B0082,
|
||||
Ivory = 0xFFFFFFF0,
|
||||
Khaki = 0xFFF0E68C,
|
||||
Lavender = 0xFFE6E6FA,
|
||||
LavenderBlush = 0xFFFFF0F5,
|
||||
LawnGreen = 0xFF7CFC00,
|
||||
LemonChiffon = 0xFFFFFACD,
|
||||
LightBlue = 0xFFADD8E6,
|
||||
LightCoral = 0xFFF08080,
|
||||
LightCyan = 0xFFE0FFFF,
|
||||
LightGoldenrodYellow = 0xFFFAFAD2,
|
||||
LightGray = 0xFFD3D3D3,
|
||||
LightGreen = 0xFF90EE90,
|
||||
LightPink = 0xFFFFB6C1,
|
||||
LightSalmon = 0xFFFFA07A,
|
||||
LightSeaGreen = 0xFF20B2AA,
|
||||
LightSkyBlue = 0xFF87CEFA,
|
||||
LightSlateGray = 0xFF778899,
|
||||
LightSteelBlue = 0xFFB0C4DE,
|
||||
LightYellow = 0xFFFFFFE0,
|
||||
Lime = 0xFF00FF00,
|
||||
LimeGreen = 0xFF32CD32,
|
||||
Linen = 0xFFFAF0E6,
|
||||
Magenta = 0xFFFF00FF,
|
||||
Maroon = 0xFF800000,
|
||||
MediumAquamarine = 0xFF66CDAA,
|
||||
MediumBlue = 0xFF0000CD,
|
||||
MediumOrchid = 0xFFBA55D3,
|
||||
MediumPurple = 0xFF9370DB,
|
||||
MediumSeaGreen = 0xFF3CB371,
|
||||
MediumSlateBlue = 0xFF7B68EE,
|
||||
MediumSpringGreen = 0xFF00FA9A,
|
||||
MediumTurquoise = 0xFF48D1CC,
|
||||
MediumVioletRed = 0xFFC71585,
|
||||
MidnightBlue = 0xFF191970,
|
||||
MintCream = 0xFFF5FFFA,
|
||||
MistyRose = 0xFFFFE4E1,
|
||||
Moccasin = 0xFFFFE4B5,
|
||||
NavajoWhite = 0xFFFFDEAD,
|
||||
Navy = 0xFF000080,
|
||||
OldLace = 0xFFFDF5E6,
|
||||
Olive = 0xFF808000,
|
||||
OliveDrab = 0xFF6B8E23,
|
||||
Orange = 0xFFFFA500,
|
||||
OrangeRed = 0xFFFF4500,
|
||||
Orchid = 0xFFDA70D6,
|
||||
PaleGoldenrod = 0xFFEEE8AA,
|
||||
PaleGreen = 0xFF98FB98,
|
||||
PaleTurquoise = 0xFFAFEEEE,
|
||||
PaleVioletRed = 0xFFDB7093,
|
||||
PapayaWhip = 0xFFFFEFD5,
|
||||
PeachPuff = 0xFFFFDAB9,
|
||||
Peru = 0xFFCD853F,
|
||||
Pink = 0xFFFFC0CB,
|
||||
Plum = 0xFFDDA0DD,
|
||||
PowderBlue = 0xFFB0E0E6,
|
||||
Purple = 0xFF800080,
|
||||
Red = 0xFFFF0000,
|
||||
RosyBrown = 0xFFBC8F8F,
|
||||
RoyalBlue = 0xFF4169E1,
|
||||
SaddleBrown = 0xFF8B4513,
|
||||
Salmon = 0xFFFA8072,
|
||||
SandyBrown = 0xFFF4A460,
|
||||
SeaGreen = 0xFF2E8B57,
|
||||
SeaShell = 0xFFFFF5EE,
|
||||
Sienna = 0xFFA0522D,
|
||||
Silver = 0xFFC0C0C0,
|
||||
SkyBlue = 0xFF87CEEB,
|
||||
SlateBlue = 0xFF6A5ACD,
|
||||
SlateGray = 0xFF708090,
|
||||
Snow = 0xFFFFFAFA,
|
||||
SpringGreen = 0xFF00FF7F,
|
||||
SteelBlue = 0xFF4682B4,
|
||||
Tan = 0xFFD2B48C,
|
||||
Teal = 0xFF008080,
|
||||
Thistle = 0xFFD8BFD8,
|
||||
Tomato = 0xFFFF6347,
|
||||
Transparent = 0x00FFFFFF,
|
||||
Turquoise = 0xFF40E0D0,
|
||||
Violet = 0xFFEE82EE,
|
||||
Wheat = 0xFFF5DEB3,
|
||||
White = 0xFFFFFFFF,
|
||||
WhiteSmoke = 0xFFF5F5F5,
|
||||
Yellow = 0xFFFFFF00,
|
||||
YellowGreen = 0xFF9ACD32
|
||||
};
|
||||
|
||||
// Shift count and bit mask for A, R, G, B components
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaShift = 24,
|
||||
RedShift = 16,
|
||||
GreenShift = 8,
|
||||
BlueShift = 0
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AlphaMask = 0xff000000,
|
||||
RedMask = 0x00ff0000,
|
||||
GreenMask = 0x0000ff00,
|
||||
BlueMask = 0x000000ff
|
||||
};
|
||||
|
||||
// Assemble A, R, G, B values into a 32-bit integer
|
||||
|
||||
static ARGB MakeARGB(IN BYTE a,
|
||||
IN BYTE r,
|
||||
IN BYTE g,
|
||||
IN BYTE b)
|
||||
{
|
||||
return (((ARGB) (b) << BlueShift) |
|
||||
((ARGB) (g) << GreenShift) |
|
||||
((ARGB) (r) << RedShift) |
|
||||
((ARGB) (a) << AlphaShift));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
ARGB Argb;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,63 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusColorMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Color Matrix object, used with Graphics.DrawImage
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSCOLORMATRIX_H
|
||||
#define _GDIPLUSCOLORMATRIX_H
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color matrix
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMatrix
|
||||
{
|
||||
REAL m[5][5];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Matrix flags
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorMatrixFlags
|
||||
{
|
||||
ColorMatrixFlagsDefault = 0,
|
||||
ColorMatrixFlagsSkipGrays = 1,
|
||||
ColorMatrixFlagsAltGray = 2
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Adjust Type
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
enum ColorAdjustType
|
||||
{
|
||||
ColorAdjustTypeDefault,
|
||||
ColorAdjustTypeBitmap,
|
||||
ColorAdjustTypeBrush,
|
||||
ColorAdjustTypePen,
|
||||
ColorAdjustTypeText,
|
||||
ColorAdjustTypeCount,
|
||||
ColorAdjustTypeAny // Reserved
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Color Map
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
struct ColorMap
|
||||
{
|
||||
Color oldColor;
|
||||
Color newColor;
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,280 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFont.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONT_H
|
||||
#define _GDIPLUSFONT_H
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const HFONT hfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (hfont)
|
||||
{
|
||||
LOGFONTA lf;
|
||||
|
||||
if(GetObjectA(hfont, sizeof(LOGFONTA), &lf))
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
else
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTW* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN HDC hdc,
|
||||
IN const LOGFONTA* logfont)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
if (logfont)
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font);
|
||||
}
|
||||
else
|
||||
{
|
||||
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
|
||||
}
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const FontFamily * family,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit
|
||||
)
|
||||
{
|
||||
GpFont *font = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&font);
|
||||
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(
|
||||
IN const WCHAR * familyName,
|
||||
IN REAL emSize,
|
||||
IN INT style,
|
||||
IN Unit unit,
|
||||
IN const FontCollection * fontCollection
|
||||
)
|
||||
{
|
||||
nativeFont = NULL;
|
||||
|
||||
FontFamily family(familyName, fontCollection);
|
||||
GpFontFamily *nativeFamily = family.nativeFamily;
|
||||
|
||||
lastResult = family.GetLastStatus();
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
}
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
|
||||
if (lastResult != Ok)
|
||||
{
|
||||
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
|
||||
lastResult = FontFamily::GenericSansSerif()->lastResult;
|
||||
if (lastResult != Ok)
|
||||
return;
|
||||
|
||||
lastResult = DllExports::GdipCreateFont(
|
||||
nativeFamily,
|
||||
emSize,
|
||||
style,
|
||||
unit,
|
||||
&nativeFont);
|
||||
}
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontA(IN const Graphics *g,
|
||||
OUT LOGFONTA *logfontA) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA));
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLogFontW(IN const Graphics *g,
|
||||
OUT LOGFONTW *logfontW) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW));
|
||||
}
|
||||
|
||||
|
||||
inline Font*
|
||||
Font::Clone() const
|
||||
{
|
||||
GpFont *cloneFont = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont));
|
||||
|
||||
return new Font(cloneFont, lastResult);
|
||||
}
|
||||
|
||||
inline
|
||||
Font::~Font()
|
||||
{
|
||||
DllExports::GdipDeleteFont(nativeFont);
|
||||
}
|
||||
|
||||
// Operations
|
||||
|
||||
inline BOOL
|
||||
Font::IsAvailable() const
|
||||
{
|
||||
return (nativeFont ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetFamily(OUT FontFamily *family) const
|
||||
{
|
||||
if (family == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily));
|
||||
family->SetStatus(status);
|
||||
|
||||
return SetStatus(status);
|
||||
}
|
||||
|
||||
inline INT
|
||||
Font::GetStyle() const
|
||||
{
|
||||
INT style;
|
||||
|
||||
SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style));
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetSize() const
|
||||
{
|
||||
REAL size;
|
||||
SetStatus(DllExports::GdipGetFontSize(nativeFont, &size));
|
||||
return size;
|
||||
}
|
||||
|
||||
inline Unit
|
||||
Font::GetUnit() const
|
||||
{
|
||||
Unit unit;
|
||||
SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit));
|
||||
return unit;
|
||||
}
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN const Graphics *graphics) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeight(
|
||||
nativeFont,
|
||||
graphics ? graphics->nativeGraphics : NULL,
|
||||
&height
|
||||
));
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
inline REAL
|
||||
Font::GetHeight(IN REAL dpi) const
|
||||
{
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height));
|
||||
return height;
|
||||
}
|
||||
|
||||
inline
|
||||
Font::Font(IN GpFont* font,
|
||||
IN Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativeFont(font);
|
||||
}
|
||||
|
||||
inline VOID
|
||||
Font::SetNativeFont(GpFont *Font)
|
||||
{
|
||||
nativeFont = Font;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::GetLastStatus(void) const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
Font::SetStatus(IN Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,134 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontCollection.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Font collections (Installed and Private)
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSFONTCOLL_H
|
||||
#define _GDIPLUSFONTCOLL_H
|
||||
|
||||
inline
|
||||
FontCollection::FontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
}
|
||||
|
||||
inline
|
||||
FontCollection::~FontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline INT
|
||||
FontCollection::GetFamilyCount() const
|
||||
{
|
||||
INT numFound = 0;
|
||||
|
||||
lastResult = DllExports::GdipGetFontCollectionFamilyCount(
|
||||
nativeFontCollection, &numFound);
|
||||
|
||||
|
||||
|
||||
return numFound;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::GetFamilies(
|
||||
IN INT numSought,
|
||||
OUT FontFamily * gpfamilies,
|
||||
OUT INT * numFound
|
||||
) const
|
||||
{
|
||||
if (numSought <= 0 || gpfamilies == NULL || numFound == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
*numFound = 0;
|
||||
GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought];
|
||||
|
||||
if (nativeFamilyList == NULL)
|
||||
{
|
||||
return SetStatus(OutOfMemory);
|
||||
}
|
||||
|
||||
Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList(
|
||||
nativeFontCollection,
|
||||
numSought,
|
||||
nativeFamilyList,
|
||||
numFound
|
||||
));
|
||||
if (status == Ok)
|
||||
{
|
||||
for (INT i = 0; i < *numFound; i++)
|
||||
{
|
||||
DllExports::GdipCloneFontFamily(nativeFamilyList[i],
|
||||
&gpfamilies[i].nativeFamily);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] nativeFamilyList;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
inline Status FontCollection::GetLastStatus () const
|
||||
{
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontCollection::SetStatus(IN Status status) const
|
||||
{
|
||||
lastResult = status;
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::InstalledFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
InstalledFontCollection::~InstalledFontCollection()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::PrivateFontCollection()
|
||||
{
|
||||
nativeFontCollection = NULL;
|
||||
lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline
|
||||
PrivateFontCollection::~PrivateFontCollection()
|
||||
{
|
||||
DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection);
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddFontFile(IN const WCHAR* filename)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename));
|
||||
}
|
||||
|
||||
inline Status
|
||||
PrivateFontCollection::AddMemoryFont(IN const void* memory,
|
||||
IN INT length)
|
||||
{
|
||||
return SetStatus(DllExports::GdipPrivateAddMemoryFont(
|
||||
nativeFontCollection,
|
||||
memory,
|
||||
length));
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSFONTCOLL_H
|
|
@ -1,207 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusFontFamily.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Font Family class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUS_FONT_FAMILY_H
|
||||
#define _GDIPLUS_FONT_FAMILY_H
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily() :
|
||||
nativeFamily (NULL),
|
||||
lastResult (Ok)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN const WCHAR* name,
|
||||
IN const FontCollection* fontCollection
|
||||
)
|
||||
{
|
||||
nativeFamily = NULL;
|
||||
lastResult = DllExports::GdipCreateFontFamilyFromName(
|
||||
name,
|
||||
fontCollection ? fontCollection->nativeFontCollection : NULL,
|
||||
&nativeFamily
|
||||
);
|
||||
}
|
||||
|
||||
inline
|
||||
FontFamily::FontFamily(
|
||||
IN GpFontFamily *nativeOrig,
|
||||
IN Status status
|
||||
)
|
||||
{
|
||||
lastResult = status;
|
||||
nativeFamily = nativeOrig;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSansSerif()
|
||||
{
|
||||
if (GenericSansSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSansSerifFontFamily =
|
||||
(FontFamily*) GenericSansSerifFontFamilyBuffer;
|
||||
|
||||
GenericSansSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySansSerif(
|
||||
&(GenericSansSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSansSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericSerif()
|
||||
{
|
||||
if (GenericSerifFontFamily != NULL)
|
||||
{
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
GenericSerifFontFamily =
|
||||
(FontFamily*) GenericSerifFontFamilyBuffer;
|
||||
|
||||
GenericSerifFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilySerif(
|
||||
&(GenericSerifFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericSerifFontFamily;
|
||||
}
|
||||
|
||||
inline const FontFamily *
|
||||
FontFamily::GenericMonospace()
|
||||
{
|
||||
if (GenericMonospaceFontFamily != NULL)
|
||||
{
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
GenericMonospaceFontFamily =
|
||||
(FontFamily*) GenericMonospaceFontFamilyBuffer;
|
||||
|
||||
GenericMonospaceFontFamily->lastResult =
|
||||
DllExports::GdipGetGenericFontFamilyMonospace(
|
||||
&(GenericMonospaceFontFamily->nativeFamily)
|
||||
);
|
||||
|
||||
return GenericMonospaceFontFamily;
|
||||
}
|
||||
|
||||
inline FontFamily::~FontFamily()
|
||||
{
|
||||
DllExports::GdipDeleteFontFamily (nativeFamily);
|
||||
}
|
||||
|
||||
inline FontFamily *
|
||||
FontFamily::Clone() const
|
||||
{
|
||||
GpFontFamily * clonedFamily = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily));
|
||||
|
||||
return new FontFamily(clonedFamily, lastResult);
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetFamilyName(
|
||||
IN WCHAR name[LF_FACESIZE],
|
||||
IN LANGID language
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetFamilyName(nativeFamily,
|
||||
name,
|
||||
language));
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
FontFamily::IsStyleAvailable(IN INT style) const
|
||||
{
|
||||
BOOL StyleAvailable;
|
||||
Status status;
|
||||
|
||||
status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable));
|
||||
|
||||
if (status != Ok)
|
||||
StyleAvailable = FALSE;
|
||||
|
||||
return StyleAvailable;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetEmHeight(IN INT style) const
|
||||
{
|
||||
UINT16 EmHeight;
|
||||
|
||||
SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight));
|
||||
|
||||
return EmHeight;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellAscent(IN INT style) const
|
||||
{
|
||||
UINT16 CellAscent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent));
|
||||
|
||||
return CellAscent;
|
||||
}
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetCellDescent(IN INT style) const
|
||||
{
|
||||
UINT16 CellDescent;
|
||||
|
||||
SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent));
|
||||
|
||||
return CellDescent;
|
||||
}
|
||||
|
||||
|
||||
inline UINT16
|
||||
FontFamily::GetLineSpacing(IN INT style) const
|
||||
{
|
||||
UINT16 LineSpacing;
|
||||
|
||||
SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing));
|
||||
|
||||
return LineSpacing;
|
||||
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
inline Status
|
||||
FontFamily::SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,107 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusGpStubs.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* Private GDI+ header file.
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSGPSTUBS_H
|
||||
#define _GDIPLUSGPSTUBS_H
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// GDI+ classes for forward reference
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class Graphics;
|
||||
class Pen;
|
||||
class Brush;
|
||||
class Matrix;
|
||||
class Bitmap;
|
||||
class Metafile;
|
||||
class GraphicsPath;
|
||||
class PathIterator;
|
||||
class Region;
|
||||
class Image;
|
||||
class TextureBrush;
|
||||
class HatchBrush;
|
||||
class SolidBrush;
|
||||
class LinearGradientBrush;
|
||||
class PathGradientBrush;
|
||||
class Font;
|
||||
class FontFamily;
|
||||
class FontCollection;
|
||||
class InstalledFontCollection;
|
||||
class PrivateFontCollection;
|
||||
class ImageAttributes;
|
||||
class CachedBitmap;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Private GDI+ classes for internal type checking
|
||||
//---------------------------------------------------------------------------
|
||||
class GpGraphics {};
|
||||
|
||||
class GpBrush {};
|
||||
class GpTexture : public GpBrush {};
|
||||
class GpSolidFill : public GpBrush {};
|
||||
class GpLineGradient : public GpBrush {};
|
||||
class GpPathGradient : public GpBrush {};
|
||||
class GpHatch : public GpBrush {};
|
||||
|
||||
class GpPen {};
|
||||
class GpCustomLineCap {};
|
||||
class GpAdjustableArrowCap : public GpCustomLineCap {};
|
||||
|
||||
class GpImage {};
|
||||
class GpBitmap : public GpImage {};
|
||||
class GpMetafile : public GpImage {};
|
||||
class GpImageAttributes {};
|
||||
|
||||
class GpPath {};
|
||||
class GpRegion {};
|
||||
class GpPathIterator {};
|
||||
|
||||
class GpFontFamily {};
|
||||
class GpFont {};
|
||||
class GpStringFormat {};
|
||||
class GpFontCollection {};
|
||||
class GpInstalledFontCollection : public GpFontCollection {};
|
||||
class GpPrivateFontCollection : public GpFontCollection {};
|
||||
|
||||
class GpCachedBitmap;
|
||||
|
||||
typedef Status GpStatus;
|
||||
typedef FillMode GpFillMode;
|
||||
typedef WrapMode GpWrapMode;
|
||||
typedef Unit GpUnit;
|
||||
typedef CoordinateSpace GpCoordinateSpace;
|
||||
typedef PointF GpPointF;
|
||||
typedef Point GpPoint;
|
||||
typedef RectF GpRectF;
|
||||
typedef Rect GpRect;
|
||||
typedef SizeF GpSizeF;
|
||||
typedef HatchStyle GpHatchStyle;
|
||||
typedef DashStyle GpDashStyle;
|
||||
typedef LineCap GpLineCap;
|
||||
typedef DashCap GpDashCap;
|
||||
|
||||
|
||||
typedef PenAlignment GpPenAlignment;
|
||||
|
||||
typedef LineJoin GpLineJoin;
|
||||
typedef PenType GpPenType;
|
||||
|
||||
typedef Matrix GpMatrix;
|
||||
typedef BrushType GpBrushType;
|
||||
typedef MatrixOrder GpMatrixOrder;
|
||||
typedef FlushIntention GpFlushIntention;
|
||||
typedef PathData GpPathData;
|
||||
|
||||
#endif // !_GDIPLUSGPSTUBS.HPP
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,671 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusHeaders.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Region, Font, Image, CustomLineCap class definitions.
|
||||
*
|
||||
*
|
||||
* Class definition and inline class implementation are separated into
|
||||
* different files to avoid circular dependencies.
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSHEADERS_H
|
||||
#define _GDIPLUSHEADERS_H
|
||||
|
||||
class Region : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
|
||||
Region();
|
||||
Region(IN const RectF& rect);
|
||||
Region(IN const Rect& rect);
|
||||
Region(IN const GraphicsPath* path);
|
||||
Region(IN const BYTE* regionData, IN INT size);
|
||||
Region(IN HRGN hRgn);
|
||||
static Region* FromHRGN(IN HRGN hRgn);
|
||||
|
||||
~Region();
|
||||
Region* Clone() const;
|
||||
|
||||
Status MakeInfinite();
|
||||
Status MakeEmpty();
|
||||
|
||||
UINT GetDataSize() const;
|
||||
|
||||
// buffer - where to put the data
|
||||
// bufferSize - how big the buffer is (should be at least as big as GetDataSize())
|
||||
// sizeFilled - if not NULL, this is an OUT param that says how many bytes
|
||||
// of data were written to the buffer.
|
||||
|
||||
Status GetData(OUT BYTE* buffer,
|
||||
IN UINT bufferSize,
|
||||
OUT UINT* sizeFilled = NULL) const;
|
||||
|
||||
Status Intersect(IN const Rect& rect);
|
||||
Status Intersect(IN const RectF& rect);
|
||||
Status Intersect(IN const GraphicsPath* path);
|
||||
Status Intersect(IN const Region* region);
|
||||
Status Union(IN const Rect& rect);
|
||||
Status Union(IN const RectF& rect);
|
||||
Status Union(IN const GraphicsPath* path);
|
||||
Status Union(IN const Region* region);
|
||||
Status Xor(IN const Rect& rect);
|
||||
Status Xor(IN const RectF& rect);
|
||||
Status Xor(IN const GraphicsPath* path);
|
||||
Status Xor(IN const Region* region);
|
||||
Status Exclude(IN const Rect& rect);
|
||||
Status Exclude(IN const RectF& rect);
|
||||
Status Exclude(IN const GraphicsPath* path);
|
||||
Status Exclude(IN const Region* region);
|
||||
Status Complement(IN const Rect& rect);
|
||||
Status Complement(IN const RectF& rect);
|
||||
Status Complement(IN const GraphicsPath* path);
|
||||
Status Complement(IN const Region* region);
|
||||
Status Translate(IN REAL dx,
|
||||
IN REAL dy);
|
||||
Status Translate(IN INT dx,
|
||||
IN INT dy);
|
||||
Status Transform(IN const Matrix* matrix);
|
||||
|
||||
Status GetBounds(OUT Rect* rect,
|
||||
IN const Graphics* g) const;
|
||||
|
||||
Status GetBounds(OUT RectF* rect,
|
||||
IN const Graphics* g) const;
|
||||
|
||||
HRGN GetHRGN (IN const Graphics * g) const;
|
||||
|
||||
BOOL IsEmpty(IN const Graphics *g) const;
|
||||
BOOL IsInfinite(IN const Graphics *g) const;
|
||||
|
||||
BOOL IsVisible(IN INT x,
|
||||
IN INT y,
|
||||
IN const Graphics* g = NULL) const
|
||||
{
|
||||
return IsVisible(Point(x, y), g);
|
||||
}
|
||||
|
||||
BOOL IsVisible(IN const Point& point,
|
||||
IN const Graphics* g = NULL) const;
|
||||
|
||||
BOOL IsVisible(IN REAL x,
|
||||
IN REAL y,
|
||||
IN const Graphics* g = NULL) const
|
||||
{
|
||||
return IsVisible(PointF(x, y), g);
|
||||
}
|
||||
|
||||
BOOL IsVisible(IN const PointF& point,
|
||||
IN const Graphics* g = NULL) const;
|
||||
|
||||
BOOL IsVisible(IN INT x,
|
||||
IN INT y,
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
return IsVisible(Rect(x, y, width, height), g);
|
||||
}
|
||||
|
||||
BOOL IsVisible(IN const Rect& rect,
|
||||
IN const Graphics* g = NULL) const;
|
||||
|
||||
BOOL IsVisible(IN REAL x,
|
||||
IN REAL y,
|
||||
IN REAL width,
|
||||
IN REAL height,
|
||||
IN const Graphics* g = NULL) const
|
||||
{
|
||||
return IsVisible(RectF(x, y, width, height), g);
|
||||
}
|
||||
|
||||
BOOL IsVisible(IN const RectF& rect,
|
||||
IN const Graphics* g = NULL) const;
|
||||
|
||||
BOOL Equals(IN const Region* region,
|
||||
IN const Graphics* g) const;
|
||||
|
||||
UINT GetRegionScansCount(IN const Matrix* matrix) const;
|
||||
Status GetRegionScans(IN const Matrix* matrix,
|
||||
OUT RectF* rects,
|
||||
OUT INT* count) const;
|
||||
Status GetRegionScans(IN const Matrix* matrix,
|
||||
OUT Rect* rects,
|
||||
OUT INT* count) const;
|
||||
Status GetLastStatus() const;
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
Region(const Region ®ion);
|
||||
Region& operator=(const Region ®ion);
|
||||
protected:
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
Region(GpRegion* nativeRegion);
|
||||
|
||||
VOID SetNativeRegion(GpRegion* nativeRegion);
|
||||
|
||||
protected:
|
||||
GpRegion* nativeRegion;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// FontFamily
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class FontFamily : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Font;
|
||||
friend class Graphics;
|
||||
friend class GraphicsPath;
|
||||
friend class FontCollection;
|
||||
|
||||
FontFamily();
|
||||
|
||||
FontFamily(
|
||||
IN const WCHAR *name,
|
||||
IN const FontCollection *fontCollection = NULL
|
||||
);
|
||||
|
||||
~FontFamily();
|
||||
|
||||
static const FontFamily *GenericSansSerif();
|
||||
static const FontFamily *GenericSerif();
|
||||
static const FontFamily *GenericMonospace();
|
||||
|
||||
Status GetFamilyName(
|
||||
OUT WCHAR name[LF_FACESIZE],
|
||||
IN LANGID language = 0
|
||||
) const;
|
||||
|
||||
FontFamily * Clone() const;
|
||||
|
||||
BOOL IsAvailable() const
|
||||
{
|
||||
return (nativeFamily != NULL);
|
||||
};
|
||||
|
||||
BOOL IsStyleAvailable(IN INT style) const;
|
||||
|
||||
UINT16 GetEmHeight (IN INT style) const;
|
||||
UINT16 GetCellAscent (IN INT style) const;
|
||||
UINT16 GetCellDescent (IN INT style) const;
|
||||
UINT16 GetLineSpacing (IN INT style) const;
|
||||
|
||||
Status GetLastStatus() const;
|
||||
|
||||
private:
|
||||
FontFamily(const FontFamily &);
|
||||
FontFamily& operator=(const FontFamily &);
|
||||
|
||||
protected:
|
||||
Status SetStatus(Status status) const;
|
||||
|
||||
FontFamily(GpFontFamily * nativeFamily, Status status);
|
||||
|
||||
protected:
|
||||
|
||||
GpFontFamily *nativeFamily;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
static FontFamily *GenericSansSerifFontFamily = NULL;
|
||||
static FontFamily *GenericSerifFontFamily = NULL;
|
||||
static FontFamily *GenericMonospaceFontFamily = NULL;
|
||||
|
||||
static BYTE GenericSansSerifFontFamilyBuffer[sizeof(FontFamily)] = {0};
|
||||
static BYTE GenericSerifFontFamilyBuffer [sizeof(FontFamily)] = {0};
|
||||
static BYTE GenericMonospaceFontFamilyBuffer[sizeof(FontFamily)] = {0};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Font
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Font : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
|
||||
Font(IN HDC hdc);
|
||||
Font(IN HDC hdc,
|
||||
IN const LOGFONTA* logfont);
|
||||
Font(IN HDC hdc,
|
||||
IN const LOGFONTW* logfont);
|
||||
Font(IN HDC hdc,
|
||||
IN const HFONT hfont);
|
||||
Font(
|
||||
IN const FontFamily * family,
|
||||
IN REAL emSize,
|
||||
IN INT style = FontStyleRegular,
|
||||
IN Unit unit = UnitPoint
|
||||
);
|
||||
|
||||
Font(
|
||||
IN const WCHAR * familyName,
|
||||
IN REAL emSize,
|
||||
IN INT style = FontStyleRegular,
|
||||
IN Unit unit = UnitPoint,
|
||||
IN const FontCollection * fontCollection = NULL
|
||||
);
|
||||
|
||||
Status GetLogFontA(IN const Graphics* g,
|
||||
OUT LOGFONTA * logfontA) const;
|
||||
Status GetLogFontW(IN const Graphics* g,
|
||||
OUT LOGFONTW * logfontW) const;
|
||||
|
||||
Font* Clone() const;
|
||||
~Font();
|
||||
BOOL IsAvailable() const;
|
||||
INT GetStyle() const;
|
||||
REAL GetSize() const;
|
||||
Unit GetUnit() const;
|
||||
Status GetLastStatus() const;
|
||||
REAL GetHeight(IN const Graphics *graphics) const;
|
||||
REAL GetHeight(IN REAL dpi) const;
|
||||
|
||||
Status GetFamily(OUT FontFamily *family) const;
|
||||
|
||||
private:
|
||||
Font(const Font &);
|
||||
Font& operator=(const Font &);
|
||||
|
||||
protected:
|
||||
Font(GpFont* font, Status status);
|
||||
VOID SetNativeFont(GpFont *Font);
|
||||
Status SetStatus(Status status) const;
|
||||
|
||||
protected:
|
||||
|
||||
GpFont* nativeFont;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Font Collection
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class FontCollection : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class FontFamily;
|
||||
|
||||
FontCollection();
|
||||
virtual ~FontCollection();
|
||||
|
||||
INT GetFamilyCount() const;
|
||||
|
||||
Status GetFamilies(
|
||||
IN INT numSought,
|
||||
OUT FontFamily * gpfamilies,
|
||||
OUT INT * numFound
|
||||
) const;
|
||||
|
||||
Status GetLastStatus() const;
|
||||
|
||||
private:
|
||||
FontCollection(const FontCollection &);
|
||||
FontCollection& operator=(const FontCollection &);
|
||||
|
||||
protected:
|
||||
Status SetStatus(Status status) const ;
|
||||
|
||||
GpFontCollection *nativeFontCollection;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
|
||||
class InstalledFontCollection : public FontCollection
|
||||
{
|
||||
public:
|
||||
InstalledFontCollection();
|
||||
~InstalledFontCollection();
|
||||
|
||||
private:
|
||||
InstalledFontCollection(const InstalledFontCollection &);
|
||||
InstalledFontCollection& operator=(const InstalledFontCollection &);
|
||||
|
||||
protected:
|
||||
Status SetStatus(Status status) const ;
|
||||
};
|
||||
|
||||
|
||||
class PrivateFontCollection : public FontCollection
|
||||
{
|
||||
public:
|
||||
PrivateFontCollection();
|
||||
~PrivateFontCollection();
|
||||
|
||||
Status AddFontFile(IN const WCHAR* filename);
|
||||
Status AddMemoryFont(IN const VOID* memory,
|
||||
IN INT length);
|
||||
|
||||
private:
|
||||
PrivateFontCollection(const PrivateFontCollection &);
|
||||
PrivateFontCollection& operator=(const PrivateFontCollection &);
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Abstract base class for Image and Metafile
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Image : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Brush;
|
||||
friend class TextureBrush;
|
||||
friend class Graphics;
|
||||
|
||||
Image(
|
||||
IN const WCHAR* filename,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
Image(
|
||||
IN IStream* stream,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
static Image* FromFile(
|
||||
IN const WCHAR* filename,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
static Image* FromStream(
|
||||
IN IStream* stream,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
virtual ~Image();
|
||||
virtual Image* Clone();
|
||||
|
||||
Status Save(IN const WCHAR* filename,
|
||||
IN const CLSID* clsidEncoder,
|
||||
IN const EncoderParameters *encoderParams = NULL);
|
||||
Status Save(IN IStream* stream,
|
||||
IN const CLSID* clsidEncoder,
|
||||
IN const EncoderParameters *encoderParams = NULL);
|
||||
Status SaveAdd(IN const EncoderParameters* encoderParams);
|
||||
Status SaveAdd(IN Image* newImage,
|
||||
IN const EncoderParameters* encoderParams);
|
||||
|
||||
ImageType GetType() const;
|
||||
Status GetPhysicalDimension(OUT SizeF* size);
|
||||
Status GetBounds(OUT RectF* srcRect,
|
||||
OUT Unit* srcUnit);
|
||||
|
||||
UINT GetWidth();
|
||||
UINT GetHeight();
|
||||
REAL GetHorizontalResolution();
|
||||
REAL GetVerticalResolution();
|
||||
UINT GetFlags();
|
||||
Status GetRawFormat(OUT GUID *format);
|
||||
PixelFormat GetPixelFormat();
|
||||
|
||||
INT GetPaletteSize();
|
||||
Status GetPalette(OUT ColorPalette* palette,
|
||||
IN INT size);
|
||||
Status SetPalette(IN const ColorPalette* palette);
|
||||
|
||||
Image* GetThumbnailImage(IN UINT thumbWidth,
|
||||
IN UINT thumbHeight,
|
||||
IN GetThumbnailImageAbort callback = NULL,
|
||||
IN VOID* callbackData = NULL);
|
||||
UINT GetFrameDimensionsCount();
|
||||
Status GetFrameDimensionsList(OUT GUID* dimensionIDs,
|
||||
IN UINT count);
|
||||
UINT GetFrameCount(IN const GUID* dimensionID);
|
||||
Status SelectActiveFrame(IN const GUID* dimensionID,
|
||||
IN UINT frameIndex);
|
||||
Status RotateFlip(IN RotateFlipType rotateFlipType);
|
||||
UINT GetPropertyCount();
|
||||
Status GetPropertyIdList(IN UINT numOfProperty,
|
||||
OUT PROPID* list);
|
||||
UINT GetPropertyItemSize(IN PROPID propId);
|
||||
Status GetPropertyItem(IN PROPID propId,
|
||||
IN UINT propSize,
|
||||
OUT PropertyItem* buffer);
|
||||
Status GetPropertySize(OUT UINT* totalBufferSize,
|
||||
OUT UINT* numProperties);
|
||||
Status GetAllPropertyItems(IN UINT totalBufferSize,
|
||||
IN UINT numProperties,
|
||||
OUT PropertyItem* allItems);
|
||||
Status RemovePropertyItem(IN PROPID propId);
|
||||
Status SetPropertyItem(IN const PropertyItem* item);
|
||||
|
||||
UINT GetEncoderParameterListSize(IN const CLSID* clsidEncoder);
|
||||
Status GetEncoderParameterList(IN const CLSID* clsidEncoder,
|
||||
IN UINT size,
|
||||
OUT EncoderParameters* buffer);
|
||||
|
||||
Status GetLastStatus() const;
|
||||
|
||||
protected:
|
||||
|
||||
Image() {}
|
||||
|
||||
Image(GpImage *nativeImage, Status status);
|
||||
|
||||
VOID SetNativeImage(GpImage* nativeImage);
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
GpImage* nativeImage;
|
||||
mutable Status lastResult;
|
||||
mutable Status loadStatus;
|
||||
|
||||
private:
|
||||
Image(IN const Image& C);
|
||||
Image& operator=(IN const Image& C);
|
||||
};
|
||||
|
||||
class Bitmap : public Image
|
||||
{
|
||||
public:
|
||||
friend class Image;
|
||||
friend class CachedBitmap;
|
||||
|
||||
Bitmap(
|
||||
IN const WCHAR *filename,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
Bitmap(
|
||||
IN IStream *stream,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
static Bitmap* FromFile(
|
||||
IN const WCHAR *filename,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
static Bitmap* FromStream(
|
||||
IN IStream *stream,
|
||||
IN BOOL useEmbeddedColorManagement = FALSE
|
||||
);
|
||||
|
||||
Bitmap(IN INT width,
|
||||
IN INT height,
|
||||
IN INT stride, PixelFormat format,
|
||||
IN BYTE* scan0);
|
||||
Bitmap(IN INT width,
|
||||
IN INT height,
|
||||
IN PixelFormat format = PixelFormat32bppARGB);
|
||||
Bitmap(IN INT width,
|
||||
IN INT height,
|
||||
IN Graphics* target);
|
||||
|
||||
Bitmap* Clone(IN const Rect& rect,
|
||||
IN PixelFormat format);
|
||||
Bitmap* Clone(IN INT x,
|
||||
IN INT y,
|
||||
IN INT width,
|
||||
IN INT height,
|
||||
IN PixelFormat format);
|
||||
Bitmap* Clone(IN const RectF& rect,
|
||||
IN PixelFormat format);
|
||||
Bitmap* Clone(IN REAL x,
|
||||
IN REAL y,
|
||||
IN REAL width,
|
||||
IN REAL height,
|
||||
IN PixelFormat format);
|
||||
|
||||
Status LockBits(IN const Rect* rect,
|
||||
IN UINT flags,
|
||||
IN PixelFormat format,
|
||||
OUT BitmapData* lockedBitmapData);
|
||||
Status UnlockBits(IN BitmapData* lockedBitmapData);
|
||||
Status GetPixel(IN INT x,
|
||||
IN INT y,
|
||||
OUT Color *color);
|
||||
Status SetPixel(IN INT x,
|
||||
IN INT y,
|
||||
IN const Color &color);
|
||||
Status SetResolution(IN REAL xdpi,
|
||||
IN REAL ydpi);
|
||||
|
||||
Bitmap(IN IDirectDrawSurface7* surface);
|
||||
Bitmap(IN const BITMAPINFO* gdiBitmapInfo,
|
||||
IN VOID* gdiBitmapData);
|
||||
Bitmap(IN HBITMAP hbm,
|
||||
IN HPALETTE hpal);
|
||||
Bitmap(IN HICON hicon);
|
||||
Bitmap(IN HINSTANCE hInstance,
|
||||
IN const WCHAR * bitmapName);
|
||||
static Bitmap* FromDirectDrawSurface7(IN IDirectDrawSurface7* surface);
|
||||
static Bitmap* FromBITMAPINFO(IN const BITMAPINFO* gdiBitmapInfo,
|
||||
IN VOID* gdiBitmapData);
|
||||
static Bitmap* FromHBITMAP(IN HBITMAP hbm,
|
||||
IN HPALETTE hpal);
|
||||
static Bitmap* FromHICON(IN HICON hicon);
|
||||
static Bitmap* FromResource(IN HINSTANCE hInstance,
|
||||
IN const WCHAR * bitmapName);
|
||||
|
||||
Status GetHBITMAP(IN const Color& colorBackground,
|
||||
OUT HBITMAP *hbmReturn);
|
||||
Status GetHICON(HICON *hicon);
|
||||
|
||||
private:
|
||||
Bitmap(const Bitmap &);
|
||||
Bitmap& operator=(const Bitmap &);
|
||||
|
||||
protected:
|
||||
Bitmap(GpBitmap *nativeBitmap);
|
||||
};
|
||||
|
||||
class CustomLineCap : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
CustomLineCap(
|
||||
IN const GraphicsPath* fillPath,
|
||||
IN const GraphicsPath* strokePath,
|
||||
IN LineCap baseCap = LineCapFlat,
|
||||
IN REAL baseInset = 0
|
||||
);
|
||||
virtual ~CustomLineCap();
|
||||
|
||||
CustomLineCap* Clone() const;
|
||||
|
||||
// This changes both the start and end cap.
|
||||
|
||||
Status SetStrokeCap(IN LineCap strokeCap)
|
||||
{
|
||||
return SetStrokeCaps(strokeCap, strokeCap);
|
||||
}
|
||||
|
||||
Status SetStrokeCaps(IN LineCap startCap,
|
||||
IN LineCap endCap);
|
||||
Status GetStrokeCaps(OUT LineCap* startCap,
|
||||
OUT LineCap* endCap) const;
|
||||
Status SetStrokeJoin(IN LineJoin lineJoin);
|
||||
LineJoin GetStrokeJoin() const;
|
||||
Status SetBaseCap(IN LineCap baseCap);
|
||||
LineCap GetBaseCap() const;
|
||||
Status SetBaseInset(IN REAL inset);
|
||||
REAL GetBaseInset() const;
|
||||
Status SetWidthScale(IN REAL widthScale);
|
||||
REAL GetWidthScale() const;
|
||||
Status GetLastStatus() const;
|
||||
|
||||
protected:
|
||||
CustomLineCap();
|
||||
|
||||
private:
|
||||
CustomLineCap(const CustomLineCap &);
|
||||
CustomLineCap& operator=(const CustomLineCap &);
|
||||
|
||||
protected:
|
||||
CustomLineCap(GpCustomLineCap* nativeCap, Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativeCap(nativeCap);
|
||||
}
|
||||
|
||||
VOID SetNativeCap(GpCustomLineCap* nativeCap)
|
||||
{
|
||||
this->nativeCap = nativeCap;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpCustomLineCap* nativeCap;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
class CachedBitmap : public GdiplusBase
|
||||
{
|
||||
friend Graphics;
|
||||
|
||||
public:
|
||||
CachedBitmap(IN Bitmap *bitmap,
|
||||
IN Graphics *graphics);
|
||||
virtual ~CachedBitmap();
|
||||
|
||||
Status GetLastStatus() const;
|
||||
|
||||
private:
|
||||
CachedBitmap(const CachedBitmap &);
|
||||
CachedBitmap& operator=(const CachedBitmap &);
|
||||
|
||||
protected:
|
||||
GpCachedBitmap *nativeCachedBitmap;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
#endif // !_GDIPLUSHEADERS.HPP
|
|
@ -1,59 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusImageCodec.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Codec Image APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSIMAGECODEC_H
|
||||
#define _GDIPLUSIMAGECODEC_H
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Codec Management APIs
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
inline Status
|
||||
GetImageDecodersSize(
|
||||
OUT UINT *numDecoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageDecodersSize(numDecoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageDecoders(
|
||||
IN UINT numDecoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *decoders)
|
||||
{
|
||||
return DllExports::GdipGetImageDecoders(numDecoders, size, decoders);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncodersSize(
|
||||
OUT UINT *numEncoders,
|
||||
OUT UINT *size)
|
||||
{
|
||||
return DllExports::GdipGetImageEncodersSize(numEncoders, size);
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
GetImageEncoders(
|
||||
IN UINT numEncoders,
|
||||
IN UINT size,
|
||||
OUT ImageCodecInfo *encoders)
|
||||
{
|
||||
return DllExports::GdipGetImageEncoders(numEncoders, size, encoders);
|
||||
}
|
||||
|
||||
#endif // _GDIPLUSIMAGECODEC_H
|
|
@ -1,526 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1999-2000 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusImaging.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Imaging GUIDs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSIMAGING_H
|
||||
#define _GDIPLUSIMAGING_H
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Image file format identifiers
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_GUID(ImageFormatUndefined, 0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatMemoryBMP, 0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatBMP, 0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatEMF, 0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatWMF, 0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatJPEG, 0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatPNG, 0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatGIF, 0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Predefined multi-frame dimension IDs
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72);
|
||||
DEFINE_GUID(FrameDimensionResolution, 0x84236f7b,0x3bd3,0x428f,0x8d,0xab,0x4e,0xa1,0x43,0x9c,0xa3,0x15);
|
||||
DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Property sets
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_GUID(FormatIDImageInformation, 0xe5836cbe,0x5eef,0x4f1d,0xac,0xde,0xae,0x4c,0x43,0xb6,0x08,0xce);
|
||||
DEFINE_GUID(FormatIDJpegAppHeaders, 0x1c4afdcd,0x6177,0x43cf,0xab,0xc7,0x5f,0x51,0xaf,0x39,0xee,0x85);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Encoder parameter sets
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DEFINE_GUID(EncoderCompression, 0xe09d739d,0xccd4,0x44ee,0x8e,0xba,0x3f,0xbf,0x8b,0xe4,0xfc,0x58);
|
||||
DEFINE_GUID(EncoderColorDepth, 0x66087055,0xad66,0x4c7c,0x9a,0x18,0x38,0xa2,0x31,0x0b,0x83,0x37);
|
||||
DEFINE_GUID(EncoderScanMethod, 0x3a4e2661,0x3109,0x4e56,0x85,0x36,0x42,0xc1,0x56,0xe7,0xdc,0xfa);
|
||||
DEFINE_GUID(EncoderVersion, 0x24d18c76,0x814a,0x41a4,0xbf,0x53,0x1c,0x21,0x9c,0xcc,0xf7,0x97);
|
||||
DEFINE_GUID(EncoderRenderMethod, 0x6d42c53a,0x229a,0x4825,0x8b,0xb7,0x5c,0x99,0xe2,0xb9,0xa8,0xb8);
|
||||
DEFINE_GUID(EncoderQuality, 0x1d5be4b5,0xfa4a,0x452d,0x9c,0xdd,0x5d,0xb3,0x51,0x05,0xe7,0xeb);
|
||||
DEFINE_GUID(EncoderTransformation,0x8d0eb2d1,0xa58e,0x4ea8,0xaa,0x14,0x10,0x80,0x74,0xb7,0xb6,0xf9);
|
||||
DEFINE_GUID(EncoderLuminanceTable,0xedb33bce,0x0266,0x4a77,0xb9,0x04,0x27,0x21,0x60,0x99,0xe7,0x17);
|
||||
DEFINE_GUID(EncoderChrominanceTable,0xf2e455dc,0x09b3,0x4316,0x82,0x60,0x67,0x6a,0xda,0x32,0x48,0x1c);
|
||||
DEFINE_GUID(EncoderSaveFlag,0x292266fc,0xac40,0x47bf,0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde);
|
||||
|
||||
DEFINE_GUID(CodecIImageBytes,0x025d1823,0x6c7d,0x447b,0xbb, 0xdb, 0xa3, 0xcb, 0xc3, 0xdf, 0xa2, 0xfc);
|
||||
|
||||
MIDL_INTERFACE("025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC")
|
||||
IImageBytes : public IUnknown
|
||||
{
|
||||
public:
|
||||
// Return total number of bytes in the IStream
|
||||
|
||||
STDMETHOD(CountBytes)(
|
||||
OUT UINT *pcb
|
||||
) = 0;
|
||||
|
||||
// Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the
|
||||
// pointer to the beginning of the locked memory chunk in "ppvBytes"
|
||||
|
||||
STDMETHOD(LockBytes)(
|
||||
IN UINT cb,
|
||||
IN ULONG ulOffset,
|
||||
OUT const VOID ** ppvBytes
|
||||
) = 0;
|
||||
|
||||
// Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the
|
||||
// stream
|
||||
|
||||
STDMETHOD(UnlockBytes)(
|
||||
IN const VOID *pvBytes,
|
||||
IN UINT cb,
|
||||
IN ULONG ulOffset
|
||||
) = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ImageCodecInfo structure
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class ImageCodecInfo
|
||||
{
|
||||
public:
|
||||
CLSID Clsid;
|
||||
GUID FormatID;
|
||||
const WCHAR* CodecName;
|
||||
const WCHAR* DllName;
|
||||
const WCHAR* FormatDescription;
|
||||
const WCHAR* FilenameExtension;
|
||||
const WCHAR* MimeType;
|
||||
DWORD Flags;
|
||||
DWORD Version;
|
||||
DWORD SigCount;
|
||||
DWORD SigSize;
|
||||
const BYTE* SigPattern;
|
||||
const BYTE* SigMask;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Information flags about image codecs
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
enum ImageCodecFlags
|
||||
{
|
||||
ImageCodecFlagsEncoder = 0x00000001,
|
||||
ImageCodecFlagsDecoder = 0x00000002,
|
||||
ImageCodecFlagsSupportBitmap = 0x00000004,
|
||||
ImageCodecFlagsSupportVector = 0x00000008,
|
||||
ImageCodecFlagsSeekableEncode = 0x00000010,
|
||||
ImageCodecFlagsBlockingDecode = 0x00000020,
|
||||
|
||||
ImageCodecFlagsBuiltin = 0x00010000,
|
||||
ImageCodecFlagsSystem = 0x00020000,
|
||||
ImageCodecFlagsUser = 0x00040000
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Access modes used when calling Image::LockBits
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum ImageLockMode
|
||||
{
|
||||
ImageLockModeRead = 0x0001,
|
||||
ImageLockModeWrite = 0x0002,
|
||||
ImageLockModeUserInputBuf= 0x0004
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Information about image pixel data
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class BitmapData
|
||||
{
|
||||
public:
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
INT Stride;
|
||||
PixelFormat PixelFormat;
|
||||
VOID* Scan0;
|
||||
UINT_PTR Reserved;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Image flags
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum ImageFlags
|
||||
{
|
||||
ImageFlagsNone = 0,
|
||||
|
||||
// Low-word: shared with SINKFLAG_x
|
||||
|
||||
ImageFlagsScalable = 0x0001,
|
||||
ImageFlagsHasAlpha = 0x0002,
|
||||
ImageFlagsHasTranslucent = 0x0004,
|
||||
ImageFlagsPartiallyScalable = 0x0008,
|
||||
|
||||
// Low-word: color space definition
|
||||
|
||||
ImageFlagsColorSpaceRGB = 0x0010,
|
||||
ImageFlagsColorSpaceCMYK = 0x0020,
|
||||
ImageFlagsColorSpaceGRAY = 0x0040,
|
||||
ImageFlagsColorSpaceYCBCR = 0x0080,
|
||||
ImageFlagsColorSpaceYCCK = 0x0100,
|
||||
|
||||
// Low-word: image size info
|
||||
|
||||
ImageFlagsHasRealDPI = 0x1000,
|
||||
ImageFlagsHasRealPixelSize = 0x2000,
|
||||
|
||||
// High-word
|
||||
|
||||
ImageFlagsReadOnly = 0x00010000,
|
||||
ImageFlagsCaching = 0x00020000
|
||||
};
|
||||
|
||||
enum RotateFlipType
|
||||
{
|
||||
RotateNoneFlipNone = 0,
|
||||
Rotate90FlipNone = 1,
|
||||
Rotate180FlipNone = 2,
|
||||
Rotate270FlipNone = 3,
|
||||
|
||||
RotateNoneFlipX = 4,
|
||||
Rotate90FlipX = 5,
|
||||
Rotate180FlipX = 6,
|
||||
Rotate270FlipX = 7,
|
||||
|
||||
RotateNoneFlipY = Rotate180FlipX,
|
||||
Rotate90FlipY = Rotate270FlipX,
|
||||
Rotate180FlipY = RotateNoneFlipX,
|
||||
Rotate270FlipY = Rotate90FlipX,
|
||||
|
||||
RotateNoneFlipXY = Rotate180FlipNone,
|
||||
Rotate90FlipXY = Rotate270FlipNone,
|
||||
Rotate180FlipXY = RotateNoneFlipNone,
|
||||
Rotate270FlipXY = Rotate90FlipNone
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Encoder Parameter structure
|
||||
//---------------------------------------------------------------------------
|
||||
class EncoderParameter
|
||||
{
|
||||
public:
|
||||
GUID Guid; // GUID of the parameter
|
||||
ULONG NumberOfValues; // Number of the parameter values
|
||||
ULONG Type; // Value type, like ValueTypeLONG etc.
|
||||
VOID* Value; // A pointer to the parameter values
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Encoder Parameters structure
|
||||
//---------------------------------------------------------------------------
|
||||
class EncoderParameters
|
||||
{
|
||||
public:
|
||||
UINT Count; // Number of parameters in this structure
|
||||
EncoderParameter Parameter[1]; // Parameter values
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Property Item
|
||||
//---------------------------------------------------------------------------
|
||||
class PropertyItem
|
||||
{
|
||||
public:
|
||||
PROPID id; // ID of this property
|
||||
ULONG length; // Length of the property value, in bytes
|
||||
WORD type; // Type of the value, as one of TAG_TYPE_XXX
|
||||
// defined above
|
||||
VOID* value; // property value
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Image property types
|
||||
//---------------------------------------------------------------------------
|
||||
#define PropertyTagTypeByte 1
|
||||
#define PropertyTagTypeASCII 2
|
||||
#define PropertyTagTypeShort 3
|
||||
#define PropertyTagTypeLong 4
|
||||
#define PropertyTagTypeRational 5
|
||||
#define PropertyTagTypeUndefined 7
|
||||
#define PropertyTagTypeSLONG 9
|
||||
#define PropertyTagTypeSRational 10
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Image property ID tags
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#define PropertyTagExifIFD 0x8769
|
||||
#define PropertyTagGpsIFD 0x8825
|
||||
|
||||
#define PropertyTagNewSubfileType 0x00FE
|
||||
#define PropertyTagSubfileType 0x00FF
|
||||
#define PropertyTagImageWidth 0x0100
|
||||
#define PropertyTagImageHeight 0x0101
|
||||
#define PropertyTagBitsPerSample 0x0102
|
||||
#define PropertyTagCompression 0x0103
|
||||
#define PropertyTagPhotometricInterp 0x0106
|
||||
#define PropertyTagThreshHolding 0x0107
|
||||
#define PropertyTagCellWidth 0x0108
|
||||
#define PropertyTagCellHeight 0x0109
|
||||
#define PropertyTagFillOrder 0x010A
|
||||
#define PropertyTagDocumentName 0x010D
|
||||
#define PropertyTagImageDescription 0x010E
|
||||
#define PropertyTagEquipMake 0x010F
|
||||
#define PropertyTagEquipModel 0x0110
|
||||
#define PropertyTagStripOffsets 0x0111
|
||||
#define PropertyTagOrientation 0x0112
|
||||
#define PropertyTagSamplesPerPixel 0x0115
|
||||
#define PropertyTagRowsPerStrip 0x0116
|
||||
#define PropertyTagStripBytesCount 0x0117
|
||||
#define PropertyTagMinSampleValue 0x0118
|
||||
#define PropertyTagMaxSampleValue 0x0119
|
||||
#define PropertyTagXResolution 0x011A // Image resolution in width direction
|
||||
#define PropertyTagYResolution 0x011B // Image resolution in height direction
|
||||
#define PropertyTagPlanarConfig 0x011C // Image data arrangement
|
||||
#define PropertyTagPageName 0x011D
|
||||
#define PropertyTagXPosition 0x011E
|
||||
#define PropertyTagYPosition 0x011F
|
||||
#define PropertyTagFreeOffset 0x0120
|
||||
#define PropertyTagFreeByteCounts 0x0121
|
||||
#define PropertyTagGrayResponseUnit 0x0122
|
||||
#define PropertyTagGrayResponseCurve 0x0123
|
||||
#define PropertyTagT4Option 0x0124
|
||||
#define PropertyTagT6Option 0x0125
|
||||
#define PropertyTagResolutionUnit 0x0128 // Unit of X and Y resolution
|
||||
#define PropertyTagPageNumber 0x0129
|
||||
#define PropertyTagTransferFuncition 0x012D
|
||||
#define PropertyTagSoftwareUsed 0x0131
|
||||
#define PropertyTagDateTime 0x0132
|
||||
#define PropertyTagArtist 0x013B
|
||||
#define PropertyTagHostComputer 0x013C
|
||||
#define PropertyTagPredictor 0x013D
|
||||
#define PropertyTagWhitePoint 0x013E
|
||||
#define PropertyTagPrimaryChromaticities 0x013F
|
||||
#define PropertyTagColorMap 0x0140
|
||||
#define PropertyTagHalftoneHints 0x0141
|
||||
#define PropertyTagTileWidth 0x0142
|
||||
#define PropertyTagTileLength 0x0143
|
||||
#define PropertyTagTileOffset 0x0144
|
||||
#define PropertyTagTileByteCounts 0x0145
|
||||
#define PropertyTagInkSet 0x014C
|
||||
#define PropertyTagInkNames 0x014D
|
||||
#define PropertyTagNumberOfInks 0x014E
|
||||
#define PropertyTagDotRange 0x0150
|
||||
#define PropertyTagTargetPrinter 0x0151
|
||||
#define PropertyTagExtraSamples 0x0152
|
||||
#define PropertyTagSampleFormat 0x0153
|
||||
#define PropertyTagSMinSampleValue 0x0154
|
||||
#define PropertyTagSMaxSampleValue 0x0155
|
||||
#define PropertyTagTransferRange 0x0156
|
||||
|
||||
#define PropertyTagJPEGProc 0x0200
|
||||
#define PropertyTagJPEGInterFormat 0x0201
|
||||
#define PropertyTagJPEGInterLength 0x0202
|
||||
#define PropertyTagJPEGRestartInterval 0x0203
|
||||
#define PropertyTagJPEGLosslessPredictors 0x0205
|
||||
#define PropertyTagJPEGPointTransforms 0x0206
|
||||
#define PropertyTagJPEGQTables 0x0207
|
||||
#define PropertyTagJPEGDCTables 0x0208
|
||||
#define PropertyTagJPEGACTables 0x0209
|
||||
|
||||
#define PropertyTagYCbCrCoefficients 0x0211
|
||||
#define PropertyTagYCbCrSubsampling 0x0212
|
||||
#define PropertyTagYCbCrPositioning 0x0213
|
||||
#define PropertyTagREFBlackWhite 0x0214
|
||||
|
||||
#define PropertyTagICCProfile 0x8773 // This TAG is defined by ICC
|
||||
// for embedded ICC in TIFF
|
||||
#define PropertyTagGamma 0x0301
|
||||
#define PropertyTagICCProfileDescriptor 0x0302
|
||||
#define PropertyTagSRGBRenderingIntent 0x0303
|
||||
|
||||
#define PropertyTagImageTitle 0x0320
|
||||
#define PropertyTagCopyright 0x8298
|
||||
|
||||
// Extra TAGs (Like Adobe Image Information tags etc.)
|
||||
|
||||
#define PropertyTagResolutionXUnit 0x5001
|
||||
#define PropertyTagResolutionYUnit 0x5002
|
||||
#define PropertyTagResolutionXLengthUnit 0x5003
|
||||
#define PropertyTagResolutionYLengthUnit 0x5004
|
||||
#define PropertyTagPrintFlags 0x5005
|
||||
#define PropertyTagPrintFlagsVersion 0x5006
|
||||
#define PropertyTagPrintFlagsCrop 0x5007
|
||||
#define PropertyTagPrintFlagsBleedWidth 0x5008
|
||||
#define PropertyTagPrintFlagsBleedWidthScale 0x5009
|
||||
#define PropertyTagHalftoneLPI 0x500A
|
||||
#define PropertyTagHalftoneLPIUnit 0x500B
|
||||
#define PropertyTagHalftoneDegree 0x500C
|
||||
#define PropertyTagHalftoneShape 0x500D
|
||||
#define PropertyTagHalftoneMisc 0x500E
|
||||
#define PropertyTagHalftoneScreen 0x500F
|
||||
#define PropertyTagJPEGQuality 0x5010
|
||||
#define PropertyTagGridSize 0x5011
|
||||
#define PropertyTagThumbnailFormat 0x5012 // 1 = JPEG, 0 = RAW RGB
|
||||
#define PropertyTagThumbnailWidth 0x5013
|
||||
#define PropertyTagThumbnailHeight 0x5014
|
||||
#define PropertyTagThumbnailColorDepth 0x5015
|
||||
#define PropertyTagThumbnailPlanes 0x5016
|
||||
#define PropertyTagThumbnailRawBytes 0x5017
|
||||
#define PropertyTagThumbnailSize 0x5018
|
||||
#define PropertyTagThumbnailCompressedSize 0x5019
|
||||
#define PropertyTagColorTransferFunction 0x501A
|
||||
#define PropertyTagThumbnailData 0x501B// RAW thumbnail bits in
|
||||
// JPEG format or RGB format
|
||||
// depends on
|
||||
// PropertyTagThumbnailFormat
|
||||
|
||||
// Thumbnail related TAGs
|
||||
|
||||
#define PropertyTagThumbnailImageWidth 0x5020 // Thumbnail width
|
||||
#define PropertyTagThumbnailImageHeight 0x5021 // Thumbnail height
|
||||
#define PropertyTagThumbnailBitsPerSample 0x5022 // Number of bits per
|
||||
// component
|
||||
#define PropertyTagThumbnailCompression 0x5023 // Compression Scheme
|
||||
#define PropertyTagThumbnailPhotometricInterp 0x5024 // Pixel composition
|
||||
#define PropertyTagThumbnailImageDescription 0x5025 // Image Tile
|
||||
#define PropertyTagThumbnailEquipMake 0x5026 // Manufacturer of Image
|
||||
// Input equipment
|
||||
#define PropertyTagThumbnailEquipModel 0x5027 // Model of Image input
|
||||
// equipment
|
||||
#define PropertyTagThumbnailStripOffsets 0x5028 // Image data location
|
||||
#define PropertyTagThumbnailOrientation 0x5029 // Orientation of image
|
||||
#define PropertyTagThumbnailSamplesPerPixel 0x502A // Number of components
|
||||
#define PropertyTagThumbnailRowsPerStrip 0x502B // Number of rows per strip
|
||||
#define PropertyTagThumbnailStripBytesCount 0x502C // Bytes per compressed
|
||||
// strip
|
||||
#define PropertyTagThumbnailResolutionX 0x502D // Resolution in width
|
||||
// direction
|
||||
#define PropertyTagThumbnailResolutionY 0x502E // Resolution in height
|
||||
// direction
|
||||
#define PropertyTagThumbnailPlanarConfig 0x502F // Image data arrangement
|
||||
#define PropertyTagThumbnailResolutionUnit 0x5030 // Unit of X and Y
|
||||
// Resolution
|
||||
#define PropertyTagThumbnailTransferFunction 0x5031 // Transfer function
|
||||
#define PropertyTagThumbnailSoftwareUsed 0x5032 // Software used
|
||||
#define PropertyTagThumbnailDateTime 0x5033 // File change date and
|
||||
// time
|
||||
#define PropertyTagThumbnailArtist 0x5034 // Person who created the
|
||||
// image
|
||||
#define PropertyTagThumbnailWhitePoint 0x5035 // White point chromaticity
|
||||
#define PropertyTagThumbnailPrimaryChromaticities 0x5036
|
||||
// Chromaticities of
|
||||
// primaries
|
||||
#define PropertyTagThumbnailYCbCrCoefficients 0x5037 // Color space transforma-
|
||||
// tion coefficients
|
||||
#define PropertyTagThumbnailYCbCrSubsampling 0x5038 // Subsampling ratio of Y
|
||||
// to C
|
||||
#define PropertyTagThumbnailYCbCrPositioning 0x5039 // Y and C position
|
||||
#define PropertyTagThumbnailRefBlackWhite 0x503A // Pair of black and white
|
||||
// reference values
|
||||
#define PropertyTagThumbnailCopyRight 0x503B // CopyRight holder
|
||||
|
||||
#define PropertyTagLuminanceTable 0x5090
|
||||
#define PropertyTagChrominanceTable 0x5091
|
||||
|
||||
#define PropertyTagFrameDelay 0x5100
|
||||
#define PropertyTagLoopCount 0x5101
|
||||
|
||||
#define PropertyTagPixelUnit 0x5110 // Unit specifier for pixel/unit
|
||||
#define PropertyTagPixelPerUnitX 0x5111 // Pixels per unit in X
|
||||
#define PropertyTagPixelPerUnitY 0x5112 // Pixels per unit in Y
|
||||
#define PropertyTagPaletteHistogram 0x5113 // Palette histogram
|
||||
|
||||
// EXIF specific tag
|
||||
|
||||
#define PropertyTagExifExposureTime 0x829A
|
||||
#define PropertyTagExifFNumber 0x829D
|
||||
|
||||
#define PropertyTagExifExposureProg 0x8822
|
||||
#define PropertyTagExifSpectralSense 0x8824
|
||||
#define PropertyTagExifISOSpeed 0x8827
|
||||
#define PropertyTagExifOECF 0x8828
|
||||
|
||||
#define PropertyTagExifVer 0x9000
|
||||
#define PropertyTagExifDTOrig 0x9003 // Date & time of original
|
||||
#define PropertyTagExifDTDigitized 0x9004 // Date & time of digital data generation
|
||||
|
||||
#define PropertyTagExifCompConfig 0x9101
|
||||
#define PropertyTagExifCompBPP 0x9102
|
||||
|
||||
#define PropertyTagExifShutterSpeed 0x9201
|
||||
#define PropertyTagExifAperture 0x9202
|
||||
#define PropertyTagExifBrightness 0x9203
|
||||
#define PropertyTagExifExposureBias 0x9204
|
||||
#define PropertyTagExifMaxAperture 0x9205
|
||||
#define PropertyTagExifSubjectDist 0x9206
|
||||
#define PropertyTagExifMeteringMode 0x9207
|
||||
#define PropertyTagExifLightSource 0x9208
|
||||
#define PropertyTagExifFlash 0x9209
|
||||
#define PropertyTagExifFocalLength 0x920A
|
||||
#define PropertyTagExifMakerNote 0x927C
|
||||
#define PropertyTagExifUserComment 0x9286
|
||||
#define PropertyTagExifDTSubsec 0x9290 // Date & Time subseconds
|
||||
#define PropertyTagExifDTOrigSS 0x9291 // Date & Time original subseconds
|
||||
#define PropertyTagExifDTDigSS 0x9292 // Date & TIme digitized subseconds
|
||||
|
||||
#define PropertyTagExifFPXVer 0xA000
|
||||
#define PropertyTagExifColorSpace 0xA001
|
||||
#define PropertyTagExifPixXDim 0xA002
|
||||
#define PropertyTagExifPixYDim 0xA003
|
||||
#define PropertyTagExifRelatedWav 0xA004 // related sound file
|
||||
#define PropertyTagExifInterop 0xA005
|
||||
#define PropertyTagExifFlashEnergy 0xA20B
|
||||
#define PropertyTagExifSpatialFR 0xA20C // Spatial Frequency Response
|
||||
#define PropertyTagExifFocalXRes 0xA20E // Focal Plane X Resolution
|
||||
#define PropertyTagExifFocalYRes 0xA20F // Focal Plane Y Resolution
|
||||
#define PropertyTagExifFocalResUnit 0xA210 // Focal Plane Resolution Unit
|
||||
#define PropertyTagExifSubjectLoc 0xA214
|
||||
#define PropertyTagExifExposureIndex 0xA215
|
||||
#define PropertyTagExifSensingMethod 0xA217
|
||||
#define PropertyTagExifFileSource 0xA300
|
||||
#define PropertyTagExifSceneType 0xA301
|
||||
#define PropertyTagExifCfaPattern 0xA302
|
||||
|
||||
#define PropertyTagGpsVer 0x0000
|
||||
#define PropertyTagGpsLatitudeRef 0x0001
|
||||
#define PropertyTagGpsLatitude 0x0002
|
||||
#define PropertyTagGpsLongitudeRef 0x0003
|
||||
#define PropertyTagGpsLongitude 0x0004
|
||||
#define PropertyTagGpsAltitudeRef 0x0005
|
||||
#define PropertyTagGpsAltitude 0x0006
|
||||
#define PropertyTagGpsGpsTime 0x0007
|
||||
#define PropertyTagGpsGpsSatellites 0x0008
|
||||
#define PropertyTagGpsGpsStatus 0x0009
|
||||
#define PropertyTagGpsGpsMeasureMode 0x00A
|
||||
#define PropertyTagGpsGpsDop 0x000B // Measurement precision
|
||||
#define PropertyTagGpsSpeedRef 0x000C
|
||||
#define PropertyTagGpsSpeed 0x000D
|
||||
#define PropertyTagGpsTrackRef 0x000E
|
||||
#define PropertyTagGpsTrack 0x000F
|
||||
#define PropertyTagGpsImgDirRef 0x0010
|
||||
#define PropertyTagGpsImgDir 0x0011
|
||||
#define PropertyTagGpsMapDatum 0x0012
|
||||
#define PropertyTagGpsDestLatRef 0x0013
|
||||
#define PropertyTagGpsDestLat 0x0014
|
||||
#define PropertyTagGpsDestLongRef 0x0015
|
||||
#define PropertyTagGpsDestLong 0x0016
|
||||
#define PropertyTagGpsDestBearRef 0x0017
|
||||
#define PropertyTagGpsDestBear 0x0018
|
||||
#define PropertyTagGpsDestDistRef 0x0019
|
||||
#define PropertyTagGpsDestDist 0x001A
|
||||
|
||||
#endif
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2001 Microsoft Corporation
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus initialization
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Startup and Shutdown APIs
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSINIT_H
|
||||
#define _GDIPLUSINIT_H
|
||||
|
||||
enum DebugEventLevel
|
||||
{
|
||||
DebugEventLevelFatal,
|
||||
DebugEventLevelWarning
|
||||
};
|
||||
|
||||
// Callback function that GDI+ can call, on debug builds, for assertions
|
||||
// and warnings.
|
||||
|
||||
typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message);
|
||||
|
||||
// Notification functions which the user must call appropriately if
|
||||
// "SuppressBackgroundThread" (below) is set.
|
||||
|
||||
typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token);
|
||||
typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token);
|
||||
|
||||
// Input structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupInput
|
||||
{
|
||||
UINT32 GdiplusVersion; // Must be 1
|
||||
DebugEventProc DebugEventCallback; // Ignored on free builds
|
||||
BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call
|
||||
// the hook/unhook functions properly
|
||||
BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use
|
||||
// its internal image codecs.
|
||||
|
||||
GdiplusStartupInput(
|
||||
DebugEventProc debugEventCallback = NULL,
|
||||
BOOL suppressBackgroundThread = FALSE,
|
||||
BOOL suppressExternalCodecs = FALSE)
|
||||
{
|
||||
GdiplusVersion = 1;
|
||||
DebugEventCallback = debugEventCallback;
|
||||
SuppressBackgroundThread = suppressBackgroundThread;
|
||||
SuppressExternalCodecs = suppressExternalCodecs;
|
||||
}
|
||||
};
|
||||
|
||||
// Output structure for GdiplusStartup()
|
||||
|
||||
struct GdiplusStartupOutput
|
||||
{
|
||||
// The following 2 fields are NULL if SuppressBackgroundThread is FALSE.
|
||||
// Otherwise, they are functions which must be called appropriately to
|
||||
// replace the background thread.
|
||||
//
|
||||
// These should be called on the application's main message loop - i.e.
|
||||
// a message loop which is active for the lifetime of GDI+.
|
||||
// "NotificationHook" should be called before starting the loop,
|
||||
// and "NotificationUnhook" should be called after the loop ends.
|
||||
|
||||
NotificationHookProc NotificationHook;
|
||||
NotificationUnhookProc NotificationUnhook;
|
||||
};
|
||||
|
||||
// GDI+ initialization. Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// Must be called before GDI+ API's or constructors are used.
|
||||
//
|
||||
// token - may not be NULL - accepts a token to be passed in the corresponding
|
||||
// GdiplusShutdown call.
|
||||
// input - may not be NULL
|
||||
// output - may be NULL only if input->SuppressBackgroundThread is FALSE.
|
||||
|
||||
extern "C" Status WINAPI GdiplusStartup(
|
||||
OUT ULONG_PTR *token,
|
||||
const GdiplusStartupInput *input,
|
||||
OUT GdiplusStartupOutput *output);
|
||||
|
||||
// GDI+ termination. Must be called before GDI+ is unloaded.
|
||||
// Must not be called from DllMain - can cause deadlock.
|
||||
//
|
||||
// GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
|
||||
// to GDI+ object destructors.
|
||||
|
||||
extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
|
||||
|
||||
#endif
|
|
@ -1,262 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusLineCaps.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ CustomLineCap APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSLINECAPS_H
|
||||
#define _GDIPLUSLINECAPS_H
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap(
|
||||
IN const GraphicsPath* fillPath,
|
||||
IN const GraphicsPath* strokePath,
|
||||
IN LineCap baseCap,
|
||||
IN REAL baseInset
|
||||
)
|
||||
{
|
||||
nativeCap = NULL;
|
||||
GpPath* nativeFillPath = NULL;
|
||||
GpPath* nativeStrokePath = NULL;
|
||||
|
||||
if(fillPath)
|
||||
nativeFillPath = fillPath->nativePath;
|
||||
if(strokePath)
|
||||
nativeStrokePath = strokePath->nativePath;
|
||||
|
||||
lastResult = DllExports::GdipCreateCustomLineCap(
|
||||
nativeFillPath, nativeStrokePath,
|
||||
baseCap, baseInset, &nativeCap);
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::CustomLineCap()
|
||||
{
|
||||
nativeCap = NULL;
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
inline
|
||||
CustomLineCap::~CustomLineCap()
|
||||
{
|
||||
DllExports::GdipDeleteCustomLineCap(nativeCap);
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeCaps(
|
||||
IN LineCap startCap,
|
||||
IN LineCap endCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetStrokeCaps(
|
||||
OUT LineCap* startCap,
|
||||
OUT LineCap* endCap) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap,
|
||||
startCap, endCap));
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetStrokeJoin(
|
||||
IN LineJoin lineJoin)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap,
|
||||
lineJoin));
|
||||
}
|
||||
|
||||
inline LineJoin
|
||||
CustomLineCap::GetStrokeJoin() const
|
||||
{
|
||||
LineJoin lineJoin;
|
||||
|
||||
SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap,
|
||||
&lineJoin));
|
||||
|
||||
return lineJoin;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseCap(IN LineCap baseCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap,
|
||||
baseCap));
|
||||
}
|
||||
|
||||
inline LineCap
|
||||
CustomLineCap::GetBaseCap() const
|
||||
{
|
||||
LineCap baseCap;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap));
|
||||
|
||||
return baseCap;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetBaseInset(IN REAL inset)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap,
|
||||
inset));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetBaseInset() const
|
||||
{
|
||||
REAL inset;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
|
||||
|
||||
return inset;
|
||||
}
|
||||
|
||||
|
||||
inline Status
|
||||
CustomLineCap::SetWidthScale(IN REAL widthScale)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap,
|
||||
widthScale));
|
||||
}
|
||||
|
||||
inline REAL
|
||||
CustomLineCap::GetWidthScale() const
|
||||
{
|
||||
REAL widthScale;
|
||||
SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap,
|
||||
&widthScale));
|
||||
|
||||
return widthScale;
|
||||
}
|
||||
|
||||
inline CustomLineCap*
|
||||
CustomLineCap::Clone() const
|
||||
{
|
||||
GpCustomLineCap *newNativeLineCap = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap,
|
||||
&newNativeLineCap));
|
||||
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap,
|
||||
lastResult);
|
||||
if (newLineCap == NULL)
|
||||
{
|
||||
SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap));
|
||||
}
|
||||
|
||||
return newLineCap;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline Status
|
||||
CustomLineCap::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
return (lastStatus);
|
||||
}
|
||||
|
||||
class AdjustableArrowCap : public CustomLineCap
|
||||
{
|
||||
public:
|
||||
|
||||
AdjustableArrowCap(
|
||||
IN REAL height,
|
||||
IN REAL width,
|
||||
IN BOOL isFilled = TRUE
|
||||
)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateAdjustableArrowCap(
|
||||
height, width, isFilled, &cap);
|
||||
SetNativeCap(cap);
|
||||
}
|
||||
|
||||
Status SetHeight(IN REAL height)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(
|
||||
cap, height));
|
||||
}
|
||||
|
||||
REAL GetHeight() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL height;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(
|
||||
cap, &height));
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
Status SetWidth(IN REAL width)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(
|
||||
cap, width));
|
||||
}
|
||||
|
||||
REAL GetWidth() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL width;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(
|
||||
cap, &width));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
Status SetMiddleInset(IN REAL middleInset)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
|
||||
cap, middleInset));
|
||||
}
|
||||
|
||||
REAL GetMiddleInset() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
REAL middleInset;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
|
||||
cap, &middleInset));
|
||||
|
||||
return middleInset;
|
||||
}
|
||||
|
||||
Status SetFillState(IN BOOL isFilled)
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(
|
||||
cap, isFilled));
|
||||
}
|
||||
|
||||
BOOL IsFilled() const
|
||||
{
|
||||
GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
|
||||
BOOL isFilled;
|
||||
SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(
|
||||
cap, &isFilled));
|
||||
|
||||
return isFilled;
|
||||
}
|
||||
|
||||
private:
|
||||
AdjustableArrowCap(const AdjustableArrowCap &);
|
||||
AdjustableArrowCap& operator=(const AdjustableArrowCap &);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,307 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMatrix.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Matrix class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
class Matrix : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
friend class GraphicsPath;
|
||||
friend class TextureBrush;
|
||||
friend class LinearGradientBrush;
|
||||
friend class PathGradientBrush;
|
||||
friend class Pen;
|
||||
friend class Region;
|
||||
|
||||
// Default constructor is set to identity matrix.
|
||||
|
||||
Matrix()
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix(&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22,
|
||||
dx, dy, &matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const RectF& rect,
|
||||
IN const PointF* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
Matrix(IN const Rect& rect,
|
||||
IN const Point* dstplg)
|
||||
{
|
||||
GpMatrix *matrix = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMatrix3I(&rect,
|
||||
dstplg,
|
||||
&matrix);
|
||||
|
||||
SetNativeMatrix(matrix);
|
||||
}
|
||||
|
||||
~Matrix()
|
||||
{
|
||||
DllExports::GdipDeleteMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
Matrix *Clone() const
|
||||
{
|
||||
GpMatrix *cloneMatrix = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneMatrix(nativeMatrix,
|
||||
&cloneMatrix));
|
||||
|
||||
if (lastResult != Ok)
|
||||
return NULL;
|
||||
|
||||
return new Matrix(cloneMatrix);
|
||||
}
|
||||
|
||||
Status GetElements(OUT REAL *m) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m));
|
||||
}
|
||||
|
||||
Status SetElements(IN REAL m11,
|
||||
IN REAL m12,
|
||||
IN REAL m21,
|
||||
IN REAL m22,
|
||||
IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
m11, m12, m21, m22, dx, dy));
|
||||
}
|
||||
|
||||
REAL OffsetX() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[4];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
REAL OffsetY() const
|
||||
{
|
||||
REAL elements[6];
|
||||
|
||||
if (GetElements(&elements[0]) == Ok)
|
||||
return elements[5];
|
||||
else
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Status Reset()
|
||||
{
|
||||
// set identity matrix elements
|
||||
return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix,
|
||||
1.0, 0.0, 0.0, 1.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
Status Multiply(IN const Matrix *matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status Translate(IN REAL offsetX,
|
||||
IN REAL offsetY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX,
|
||||
offsetY, order));
|
||||
}
|
||||
|
||||
Status Scale(IN REAL scaleX,
|
||||
IN REAL scaleY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX,
|
||||
scaleY, order));
|
||||
}
|
||||
|
||||
Status Rotate(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
}
|
||||
|
||||
Status RotateAt(IN REAL angle,
|
||||
IN const PointF& center,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
if(order == MatrixOrderPrepend)
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X,
|
||||
center.Y, order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
-center.X,
|
||||
-center.Y,
|
||||
order));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
- center.X,
|
||||
- center.Y,
|
||||
order));
|
||||
SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle,
|
||||
order));
|
||||
return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix,
|
||||
center.X,
|
||||
center.Y,
|
||||
order));
|
||||
}
|
||||
}
|
||||
|
||||
Status Shear(IN REAL shearX,
|
||||
IN REAL shearY,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX,
|
||||
shearY, order));
|
||||
}
|
||||
|
||||
Status Invert()
|
||||
{
|
||||
return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix));
|
||||
}
|
||||
|
||||
// float version
|
||||
Status TransformPoints(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix,
|
||||
pts, count));
|
||||
}
|
||||
|
||||
Status TransformPoints(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT PointF* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPoints(
|
||||
nativeMatrix, pts, count));
|
||||
}
|
||||
|
||||
Status TransformVectors(IN OUT Point* pts,
|
||||
IN INT count = 1) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(
|
||||
nativeMatrix,
|
||||
pts,
|
||||
count));
|
||||
}
|
||||
|
||||
BOOL IsInvertible() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL IsIdentity() const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Matrix *matrix) const
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix,
|
||||
matrix->nativeMatrix,
|
||||
&result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix(const Matrix &);
|
||||
Matrix& operator=(const Matrix &);
|
||||
|
||||
protected:
|
||||
Matrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
lastResult = Ok;
|
||||
SetNativeMatrix(nativeMatrix);
|
||||
}
|
||||
|
||||
VOID SetNativeMatrix(GpMatrix *nativeMatrix)
|
||||
{
|
||||
this->nativeMatrix = nativeMatrix;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpMatrix *nativeMatrix;
|
||||
mutable Status lastResult;
|
||||
};
|
|
@ -1,38 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMem.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Private Memory Management APIs
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMEM_H
|
||||
#define _GDIPLUSMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define WINGDIPAPI __stdcall
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Memory Allocation APIs
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void* WINGDIPAPI
|
||||
GdipAlloc(size_t size);
|
||||
|
||||
void WINGDIPAPI
|
||||
GdipFree(void* ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !_GDIPLUSMEM_H
|
|
@ -1,381 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusMetafile.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Metafile class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMETAFILE_H
|
||||
#define _GDIPLUSMETAFILE_H
|
||||
|
||||
class Metafile : public Image
|
||||
{
|
||||
public:
|
||||
friend class Image;
|
||||
|
||||
// Playback a metafile from a HMETAFILE
|
||||
// If deleteWmf is TRUE, then when the metafile is deleted,
|
||||
// the hWmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
IN BOOL deleteWmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a metafile from a HENHMETAFILE
|
||||
// If deleteEmf is TRUE, then when the metafile is deleted,
|
||||
// the hEmf will also be deleted. Otherwise, it won't be.
|
||||
|
||||
Metafile(IN HENHMETAFILE hEmf,
|
||||
IN BOOL deleteEmf = FALSE)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN const WCHAR* filename)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromFile(filename,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Playback a WMF metafile from a file.
|
||||
|
||||
Metafile(IN const WCHAR* filename,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename,
|
||||
wmfPlaceableFileHeader,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(IN IStream* stream)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateMetafileFromStream(stream,
|
||||
&metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafile(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
// Record a metafile to memory.
|
||||
|
||||
Metafile(
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileI(
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileName(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN const WCHAR* fileName,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileFileNameI(fileName,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, NULL, MetafileFrameUnitGdi,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const RectF & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStream(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
Metafile(
|
||||
IN IStream * stream,
|
||||
IN HDC referenceHdc,
|
||||
IN const Rect & frameRect,
|
||||
IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
|
||||
IN EmfType type = EmfTypeEmfPlusDual,
|
||||
IN const WCHAR * description = NULL
|
||||
)
|
||||
{
|
||||
GpMetafile * metafile = NULL;
|
||||
|
||||
lastResult = DllExports::GdipRecordMetafileStreamI(stream,
|
||||
referenceHdc, type, &frameRect, frameUnit,
|
||||
description, &metafile);
|
||||
|
||||
SetNativeImage(metafile);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HMETAFILE hWmf,
|
||||
IN const WmfPlaceableFileHeader * wmfPlaceableFileHeader,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromWmf(hWmf,
|
||||
wmfPlaceableFileHeader,
|
||||
header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN HENHMETAFILE hEmf,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN const WCHAR* filename,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromFile(filename, header);
|
||||
}
|
||||
|
||||
static Status GetMetafileHeader(
|
||||
IN IStream * stream,
|
||||
OUT MetafileHeader * header
|
||||
)
|
||||
{
|
||||
return DllExports::GdipGetMetafileHeaderFromStream(stream, header);
|
||||
}
|
||||
|
||||
Status GetMetafileHeader(
|
||||
OUT MetafileHeader * header
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
header));
|
||||
}
|
||||
|
||||
// Once this method is called, the Metafile object is in an invalid state
|
||||
// and can no longer be used. It is the responsiblity of the caller to
|
||||
// invoke DeleteEnhMetaFile to delete this hEmf.
|
||||
|
||||
HENHMETAFILE GetHENHMETAFILE()
|
||||
{
|
||||
HENHMETAFILE hEmf;
|
||||
|
||||
SetStatus(DllExports::GdipGetHemfFromMetafile(
|
||||
(GpMetafile *)nativeImage,
|
||||
&hEmf));
|
||||
|
||||
return hEmf;
|
||||
}
|
||||
|
||||
// Used in conjuction with Graphics::EnumerateMetafile to play an EMF+
|
||||
// The data must be DWORD aligned if it's an EMF or EMF+. It must be
|
||||
// WORD aligned if it's a WMF.
|
||||
|
||||
Status PlayRecord(
|
||||
IN EmfPlusRecordType recordType,
|
||||
IN UINT flags,
|
||||
IN UINT dataSize,
|
||||
IN const BYTE * data
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipPlayMetafileRecord(
|
||||
(GpMetafile *)nativeImage,
|
||||
recordType,
|
||||
flags,
|
||||
dataSize,
|
||||
data));
|
||||
}
|
||||
|
||||
// If you're using a printer HDC for the metafile, but you want the
|
||||
// metafile rasterized at screen resolution, then use this API to set
|
||||
// the rasterization dpi of the metafile to the screen resolution,
|
||||
// e.g. 96 dpi or 120 dpi.
|
||||
|
||||
Status SetDownLevelRasterizationLimit(
|
||||
IN UINT metafileRasterizationLimitDpi
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::
|
||||
GdipSetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
metafileRasterizationLimitDpi));
|
||||
}
|
||||
|
||||
UINT GetDownLevelRasterizationLimit() const
|
||||
{
|
||||
UINT metafileRasterizationLimitDpi = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit(
|
||||
(GpMetafile *)nativeImage,
|
||||
&metafileRasterizationLimitDpi));
|
||||
|
||||
return metafileRasterizationLimitDpi;
|
||||
}
|
||||
|
||||
static UINT Metafile::EmfToWmfBits(
|
||||
IN HENHMETAFILE hemf,
|
||||
IN UINT cbData16,
|
||||
OUT LPBYTE pData16,
|
||||
IN INT iMapMode = MM_ANISOTROPIC,
|
||||
IN INT eFlags = EmfToWmfBitsFlagsDefault
|
||||
)
|
||||
{
|
||||
return DllExports::GdipEmfToWmfBits(
|
||||
hemf,
|
||||
cbData16,
|
||||
pData16,
|
||||
iMapMode,
|
||||
eFlags);
|
||||
}
|
||||
|
||||
protected:
|
||||
Metafile()
|
||||
{
|
||||
SetNativeImage(NULL);
|
||||
lastResult = Ok;
|
||||
}
|
||||
|
||||
private:
|
||||
Metafile(const Metafile &);
|
||||
Metafile& operator=(const Metafile &);
|
||||
};
|
||||
|
||||
#endif // !_METAFILE_H
|
|
@ -1,221 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Metafile headers
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Metafile Related Structures
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSMETAHEADER_H
|
||||
#define _GDIPLUSMETAHEADER_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD iType; // Record type EMR_HEADER
|
||||
DWORD nSize; // Record size in bytes. This may be greater
|
||||
// than the sizeof(ENHMETAHEADER).
|
||||
RECTL rclBounds; // Inclusive-inclusive bounds in device units
|
||||
RECTL rclFrame; // Inclusive-inclusive Picture Frame .01mm unit
|
||||
DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE.
|
||||
DWORD nVersion; // Version number
|
||||
DWORD nBytes; // Size of the metafile in bytes
|
||||
DWORD nRecords; // Number of records in the metafile
|
||||
WORD nHandles; // Number of handles in the handle table
|
||||
// Handle index zero is reserved.
|
||||
WORD sReserved; // Reserved. Must be zero.
|
||||
DWORD nDescription; // Number of chars in the unicode desc string
|
||||
// This is 0 if there is no description string
|
||||
DWORD offDescription; // Offset to the metafile description record.
|
||||
// This is 0 if there is no description string
|
||||
DWORD nPalEntries; // Number of entries in the metafile palette.
|
||||
SIZEL szlDevice; // Size of the reference device in pels
|
||||
SIZEL szlMillimeters; // Size of the reference device in millimeters
|
||||
} ENHMETAHEADER3;
|
||||
|
||||
// Placeable WMFs
|
||||
|
||||
// Placeable Metafiles were created as a non-standard way of specifying how
|
||||
// a metafile is mapped and scaled on an output device.
|
||||
// Placeable metafiles are quite wide-spread, but not directly supported by
|
||||
// the Windows API. To playback a placeable metafile using the Windows API,
|
||||
// you will first need to strip the placeable metafile header from the file.
|
||||
// This is typically performed by copying the metafile to a temporary file
|
||||
// starting at file offset 22 (0x16). The contents of the temporary file may
|
||||
// then be used as input to the Windows GetMetaFile(), PlayMetaFile(),
|
||||
// CopyMetaFile(), etc. GDI functions.
|
||||
|
||||
// Each placeable metafile begins with a 22-byte header,
|
||||
// followed by a standard metafile:
|
||||
|
||||
#include <pshpack2.h> // set structure packing to 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT16 Left;
|
||||
INT16 Top;
|
||||
INT16 Right;
|
||||
INT16 Bottom;
|
||||
} PWMFRect16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT32 Key; // GDIP_WMF_PLACEABLEKEY
|
||||
INT16 Hmf; // Metafile HANDLE number (always 0)
|
||||
PWMFRect16 BoundingBox; // Coordinates in metafile units
|
||||
INT16 Inch; // Number of metafile units per inch
|
||||
UINT32 Reserved; // Reserved (always 0)
|
||||
INT16 Checksum; // Checksum value for previous 10 WORDs
|
||||
} WmfPlaceableFileHeader;
|
||||
|
||||
#include <poppack.h>
|
||||
|
||||
// Key contains a special identification value that indicates the presence
|
||||
// of a placeable metafile header and is always 0x9AC6CDD7.
|
||||
|
||||
// Handle is used to stored the handle of the metafile in memory. When written
|
||||
// to disk, this field is not used and will always contains the value 0.
|
||||
|
||||
// Left, Top, Right, and Bottom contain the coordinates of the upper-left
|
||||
// and lower-right corners of the image on the output device. These are
|
||||
// measured in twips.
|
||||
|
||||
// A twip (meaning "twentieth of a point") is the logical unit of measurement
|
||||
// used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720
|
||||
// twips equal 1/2 inch, while 32,768 twips is 22.75 inches.
|
||||
|
||||
// Inch contains the number of twips per inch used to represent the image.
|
||||
// Normally, there are 1440 twips per inch; however, this number may be
|
||||
// changed to scale the image. A value of 720 indicates that the image is
|
||||
// double its normal size, or scaled to a factor of 2:1. A value of 360
|
||||
// indicates a scale of 4:1, while a value of 2880 indicates that the image
|
||||
// is scaled down in size by a factor of two. A value of 1440 indicates
|
||||
// a 1:1 scale ratio.
|
||||
|
||||
// Reserved is not used and is always set to 0.
|
||||
|
||||
// Checksum contains a checksum value for the previous 10 WORDs in the header.
|
||||
// This value can be used in an attempt to detect if the metafile has become
|
||||
// corrupted. The checksum is calculated by XORing each WORD value to an
|
||||
// initial value of 0.
|
||||
|
||||
// If the metafile was recorded with a reference Hdc that was a display.
|
||||
|
||||
#define GDIP_EMFPLUSFLAGS_DISPLAY 0x00000001
|
||||
|
||||
class MetafileHeader
|
||||
{
|
||||
public:
|
||||
MetafileType Type;
|
||||
UINT Size; // Size of the metafile (in bytes)
|
||||
UINT Version; // EMF+, EMF, or WMF version
|
||||
UINT EmfPlusFlags;
|
||||
REAL DpiX;
|
||||
REAL DpiY;
|
||||
INT X; // Bounds in device units
|
||||
INT Y;
|
||||
INT Width;
|
||||
INT Height;
|
||||
union
|
||||
{
|
||||
METAHEADER WmfHeader;
|
||||
ENHMETAHEADER3 EmfHeader;
|
||||
};
|
||||
INT EmfPlusHeaderSize; // size of the EMF+ header in file
|
||||
INT LogicalDpiX; // Logical Dpi of reference Hdc
|
||||
INT LogicalDpiY; // usually valid only for EMF+
|
||||
|
||||
public:
|
||||
MetafileType GetType() const { return Type; }
|
||||
|
||||
UINT GetMetafileSize() const { return Size; }
|
||||
|
||||
// If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF ver
|
||||
|
||||
UINT GetVersion() const { return Version; }
|
||||
|
||||
// Get the EMF+ flags associated with the metafile
|
||||
|
||||
UINT GetEmfPlusFlags() const { return EmfPlusFlags; }
|
||||
|
||||
REAL GetDpiX() const { return DpiX; }
|
||||
|
||||
REAL GetDpiY() const { return DpiY; }
|
||||
|
||||
VOID GetBounds (OUT Rect *rect) const
|
||||
{
|
||||
rect->X = X;
|
||||
rect->Y = Y;
|
||||
rect->Width = Width;
|
||||
rect->Height = Height;
|
||||
}
|
||||
|
||||
// Is it any type of WMF (standard or Placeable Metafile)?
|
||||
|
||||
BOOL IsWmf() const
|
||||
{
|
||||
return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfPlaceable));
|
||||
}
|
||||
|
||||
// Is this an Placeable Metafile?
|
||||
|
||||
BOOL IsWmfPlaceable() const { return (Type == MetafileTypeWmfPlaceable); }
|
||||
|
||||
// Is this an EMF (not an EMF+)?
|
||||
|
||||
BOOL IsEmf() const { return (Type == MetafileTypeEmf); }
|
||||
|
||||
// Is this an EMF or EMF+ file?
|
||||
|
||||
BOOL IsEmfOrEmfPlus() const { return (Type >= MetafileTypeEmf); }
|
||||
|
||||
// Is this an EMF+ file?
|
||||
|
||||
BOOL IsEmfPlus() const { return (Type >= MetafileTypeEmfPlusOnly); }
|
||||
|
||||
// Is this an EMF+ dual (has dual, down-level records) file?
|
||||
|
||||
BOOL IsEmfPlusDual() const { return (Type == MetafileTypeEmfPlusDual); }
|
||||
|
||||
// Is this an EMF+ only (no dual records) file?
|
||||
|
||||
BOOL IsEmfPlusOnly() const { return (Type == MetafileTypeEmfPlusOnly); }
|
||||
|
||||
// If it's an EMF+ file, was it recorded against a display Hdc?
|
||||
|
||||
BOOL IsDisplay() const
|
||||
{
|
||||
return (IsEmfPlus() &&
|
||||
((EmfPlusFlags & GDIP_EMFPLUSFLAGS_DISPLAY) != 0));
|
||||
}
|
||||
|
||||
// Get the WMF header of the metafile (if it is a WMF)
|
||||
|
||||
const METAHEADER * GetWmfHeader() const
|
||||
{
|
||||
if (IsWmf())
|
||||
{
|
||||
return &WmfHeader;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get the EMF header of the metafile (if it is an EMF)
|
||||
|
||||
const ENHMETAHEADER3 * GetEmfHeader() const
|
||||
{
|
||||
if (IsEmfOrEmfPlus())
|
||||
{
|
||||
return &EmfHeader;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,475 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusPen.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Pen class
|
||||
*
|
||||
\**************************************************************************/
|
||||
#ifndef _GDIPLUSPEN_H
|
||||
#define _GDIPLUSPEN_H
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Pen class
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Pen : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class GraphicsPath;
|
||||
friend class Graphics;
|
||||
|
||||
Pen(IN const Color& color,
|
||||
IN REAL width = 1.0f)
|
||||
{
|
||||
Unit unit = UnitWorld;
|
||||
nativePen = NULL;
|
||||
lastResult = DllExports::GdipCreatePen1(color.GetValue(),
|
||||
width, unit, &nativePen);
|
||||
}
|
||||
|
||||
Pen(IN const Brush* brush,
|
||||
IN REAL width = 1.0f)
|
||||
{
|
||||
Unit unit = UnitWorld;
|
||||
nativePen = NULL;
|
||||
lastResult = DllExports::GdipCreatePen2(brush->nativeBrush,
|
||||
width, unit, &nativePen);
|
||||
}
|
||||
|
||||
~Pen()
|
||||
{
|
||||
DllExports::GdipDeletePen(nativePen);
|
||||
}
|
||||
|
||||
Pen* Clone() const
|
||||
{
|
||||
GpPen *clonePen = NULL;
|
||||
|
||||
lastResult = DllExports::GdipClonePen(nativePen, &clonePen);
|
||||
|
||||
return new Pen(clonePen, lastResult);
|
||||
}
|
||||
|
||||
Status SetWidth(IN REAL width)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenWidth(nativePen, width));
|
||||
}
|
||||
|
||||
REAL GetWidth() const
|
||||
{
|
||||
REAL width;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenWidth(nativePen, &width));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
// Set/get line caps: start, end, and dash
|
||||
|
||||
// Line cap and join APIs by using LineCap and LineJoin enums.
|
||||
|
||||
Status SetLineCap(IN LineCap startCap,
|
||||
IN LineCap endCap,
|
||||
IN DashCap dashCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen,
|
||||
startCap, endCap, dashCap));
|
||||
}
|
||||
|
||||
Status SetStartCap(IN LineCap startCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap));
|
||||
}
|
||||
|
||||
Status SetEndCap(IN LineCap endCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap));
|
||||
}
|
||||
|
||||
Status SetDashCap(IN DashCap dashCap)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen,
|
||||
dashCap));
|
||||
}
|
||||
|
||||
LineCap GetStartCap() const
|
||||
{
|
||||
LineCap startCap;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap));
|
||||
|
||||
return startCap;
|
||||
}
|
||||
|
||||
LineCap GetEndCap() const
|
||||
{
|
||||
LineCap endCap;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap));
|
||||
|
||||
return endCap;
|
||||
}
|
||||
|
||||
DashCap GetDashCap() const
|
||||
{
|
||||
DashCap dashCap;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenDashCap197819(nativePen,
|
||||
&dashCap));
|
||||
|
||||
return dashCap;
|
||||
}
|
||||
|
||||
Status SetLineJoin(IN LineJoin lineJoin)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenLineJoin(nativePen, lineJoin));
|
||||
}
|
||||
|
||||
LineJoin GetLineJoin() const
|
||||
{
|
||||
LineJoin lineJoin;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenLineJoin(nativePen, &lineJoin));
|
||||
|
||||
return lineJoin;
|
||||
}
|
||||
|
||||
Status SetCustomStartCap(IN const CustomLineCap* customCap)
|
||||
{
|
||||
GpCustomLineCap* nativeCap = NULL;
|
||||
if(customCap)
|
||||
nativeCap = customCap->nativeCap;
|
||||
|
||||
return SetStatus(DllExports::GdipSetPenCustomStartCap(nativePen,
|
||||
nativeCap));
|
||||
}
|
||||
|
||||
Status GetCustomStartCap(OUT CustomLineCap* customCap) const
|
||||
{
|
||||
if(!customCap)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
return SetStatus(DllExports::GdipGetPenCustomStartCap(nativePen,
|
||||
&(customCap->nativeCap)));
|
||||
}
|
||||
|
||||
Status SetCustomEndCap(IN const CustomLineCap* customCap)
|
||||
{
|
||||
GpCustomLineCap* nativeCap = NULL;
|
||||
if(customCap)
|
||||
nativeCap = customCap->nativeCap;
|
||||
|
||||
return SetStatus(DllExports::GdipSetPenCustomEndCap(nativePen,
|
||||
nativeCap));
|
||||
}
|
||||
|
||||
Status GetCustomEndCap(OUT CustomLineCap* customCap) const
|
||||
{
|
||||
if(!customCap)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
return SetStatus(DllExports::GdipGetPenCustomEndCap(nativePen,
|
||||
&(customCap->nativeCap)));
|
||||
}
|
||||
|
||||
Status SetMiterLimit(IN REAL miterLimit)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenMiterLimit(nativePen,
|
||||
miterLimit));
|
||||
}
|
||||
|
||||
REAL GetMiterLimit() const
|
||||
{
|
||||
REAL miterLimit;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenMiterLimit(nativePen, &miterLimit));
|
||||
|
||||
return miterLimit;
|
||||
}
|
||||
|
||||
Status SetAlignment(IN PenAlignment penAlignment)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment));
|
||||
}
|
||||
|
||||
PenAlignment GetAlignment() const
|
||||
{
|
||||
PenAlignment penAlignment;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment));
|
||||
|
||||
return penAlignment;
|
||||
}
|
||||
|
||||
Status SetTransform(IN const Matrix* matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenTransform(nativePen,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status GetTransform(OUT Matrix* matrix) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetPenTransform(nativePen,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status ResetTransform()
|
||||
{
|
||||
return SetStatus(DllExports::GdipResetPenTransform(nativePen));
|
||||
}
|
||||
|
||||
Status MultiplyTransform(IN const Matrix* matrix,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen,
|
||||
matrix->nativeMatrix,
|
||||
order));
|
||||
}
|
||||
|
||||
Status TranslateTransform(IN REAL dx,
|
||||
IN REAL dy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslatePenTransform(nativePen,
|
||||
dx,
|
||||
dy,
|
||||
order));
|
||||
}
|
||||
|
||||
Status ScaleTransform(IN REAL sx,
|
||||
IN REAL sy,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipScalePenTransform(nativePen,
|
||||
sx,
|
||||
sy,
|
||||
order));
|
||||
}
|
||||
|
||||
Status RotateTransform(IN REAL angle,
|
||||
IN MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return SetStatus(DllExports::GdipRotatePenTransform(nativePen,
|
||||
angle,
|
||||
order));
|
||||
}
|
||||
|
||||
PenType GetPenType() const
|
||||
{
|
||||
PenType type;
|
||||
SetStatus(DllExports::GdipGetPenFillType(nativePen, &type));
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
Status SetColor(IN const Color& color)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenColor(nativePen,
|
||||
color.GetValue()));
|
||||
}
|
||||
|
||||
Status SetBrush(IN const Brush* brush)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenBrushFill(nativePen,
|
||||
brush->nativeBrush));
|
||||
}
|
||||
|
||||
Status GetColor(OUT Color* color) const
|
||||
{
|
||||
if (color == NULL)
|
||||
{
|
||||
return SetStatus(InvalidParameter);
|
||||
}
|
||||
|
||||
PenType type = GetPenType();
|
||||
|
||||
if (type != PenTypeSolidColor)
|
||||
{
|
||||
return WrongState;
|
||||
}
|
||||
|
||||
ARGB argb;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenColor(nativePen,
|
||||
&argb));
|
||||
if (lastResult == Ok)
|
||||
{
|
||||
color->SetValue(argb);
|
||||
}
|
||||
|
||||
return lastResult;
|
||||
}
|
||||
|
||||
Brush* GetBrush() const
|
||||
{
|
||||
PenType type = GetPenType();
|
||||
|
||||
Brush* brush = NULL;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case PenTypeSolidColor:
|
||||
brush = new SolidBrush();
|
||||
break;
|
||||
|
||||
case PenTypeHatchFill:
|
||||
brush = new HatchBrush();
|
||||
break;
|
||||
|
||||
case PenTypeTextureFill:
|
||||
brush = new TextureBrush();
|
||||
break;
|
||||
|
||||
case PenTypePathGradient:
|
||||
brush = new Brush();
|
||||
break;
|
||||
|
||||
case PenTypeLinearGradient:
|
||||
brush = new LinearGradientBrush();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(brush)
|
||||
{
|
||||
GpBrush* nativeBrush;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenBrushFill(nativePen,
|
||||
&nativeBrush));
|
||||
brush->SetNativeBrush(nativeBrush);
|
||||
}
|
||||
|
||||
return brush;
|
||||
}
|
||||
|
||||
DashStyle GetDashStyle() const
|
||||
{
|
||||
DashStyle dashStyle;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenDashStyle(nativePen, &dashStyle));
|
||||
|
||||
return dashStyle;
|
||||
}
|
||||
|
||||
Status SetDashStyle(IN DashStyle dashStyle)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenDashStyle(nativePen,
|
||||
dashStyle));
|
||||
}
|
||||
|
||||
REAL GetDashOffset() const
|
||||
{
|
||||
REAL dashOffset;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenDashOffset(nativePen, &dashOffset));
|
||||
|
||||
return dashOffset;
|
||||
}
|
||||
|
||||
Status SetDashOffset(IN REAL dashOffset)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenDashOffset(nativePen,
|
||||
dashOffset));
|
||||
}
|
||||
|
||||
Status SetDashPattern(IN const REAL* dashArray, IN INT count)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenDashArray(nativePen,
|
||||
dashArray,
|
||||
count));
|
||||
}
|
||||
|
||||
INT GetDashPatternCount() const
|
||||
{
|
||||
INT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenDashCount(nativePen, &count));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Status GetDashPattern(OUT REAL* dashArray,
|
||||
IN INT count) const
|
||||
{
|
||||
if (dashArray == NULL || count <= 0)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
return SetStatus(DllExports::GdipGetPenDashArray(nativePen,
|
||||
dashArray,
|
||||
count));
|
||||
}
|
||||
|
||||
Status SetCompoundArray(IN const REAL* compoundArray,
|
||||
IN INT count)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetPenCompoundArray(nativePen,
|
||||
compoundArray,
|
||||
count));
|
||||
}
|
||||
|
||||
INT GetCompoundArrayCount() const
|
||||
{
|
||||
INT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetPenCompoundCount(nativePen, &count));
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Status GetCompoundArray(OUT REAL* compoundArray,
|
||||
IN INT count) const
|
||||
{
|
||||
if (compoundArray == NULL || count <= 0)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen,
|
||||
compoundArray,
|
||||
count));
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
Pen(const Pen &);
|
||||
Pen& operator=(const Pen &);
|
||||
|
||||
protected:
|
||||
Pen(GpPen* nativePen, Status status)
|
||||
{
|
||||
lastResult = status;
|
||||
SetNativePen(nativePen);
|
||||
}
|
||||
|
||||
VOID SetNativePen(GpPen* nativePen)
|
||||
{
|
||||
this->nativePen = nativePen;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpPen* nativePen;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,124 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Gdiplus Pixel Formats
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Pixel Formats
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSPIXELFORMATS_H
|
||||
#define _GDIPLUSPIXELFORMATS_H
|
||||
|
||||
typedef DWORD ARGB;
|
||||
typedef DWORDLONG ARGB64;
|
||||
|
||||
#define ALPHA_SHIFT 24
|
||||
#define RED_SHIFT 16
|
||||
#define GREEN_SHIFT 8
|
||||
#define BLUE_SHIFT 0
|
||||
#define ALPHA_MASK ((ARGB) 0xff << ALPHA_SHIFT)
|
||||
|
||||
// In-memory pixel data formats:
|
||||
// bits 0-7 = format index
|
||||
// bits 8-15 = pixel size (in bits)
|
||||
// bits 16-23 = flags
|
||||
// bits 24-31 = reserved
|
||||
|
||||
typedef INT PixelFormat;
|
||||
|
||||
#define PixelFormatIndexed 0x00010000 // Indexes into a palette
|
||||
#define PixelFormatGDI 0x00020000 // Is a GDI-supported format
|
||||
#define PixelFormatAlpha 0x00040000 // Has an alpha component
|
||||
#define PixelFormatPAlpha 0x00080000 // Pre-multiplied alpha
|
||||
#define PixelFormatExtended 0x00100000 // Extended color 16 bits/channel
|
||||
#define PixelFormatCanonical 0x00200000
|
||||
|
||||
#define PixelFormatUndefined 0
|
||||
#define PixelFormatDontCare 0
|
||||
|
||||
#define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI)
|
||||
#define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI)
|
||||
#define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI)
|
||||
#define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended)
|
||||
#define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI)
|
||||
#define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI)
|
||||
#define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
|
||||
#define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI)
|
||||
#define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI)
|
||||
#define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
|
||||
#define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
|
||||
#define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended)
|
||||
#define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
|
||||
#define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
|
||||
#define PixelFormatMax 15
|
||||
|
||||
inline UINT
|
||||
GetPixelFormatSize(
|
||||
PixelFormat pixfmt
|
||||
)
|
||||
{
|
||||
return (pixfmt >> 8) & 0xff;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
IsIndexedPixelFormat(
|
||||
PixelFormat pixfmt
|
||||
)
|
||||
{
|
||||
return (pixfmt & PixelFormatIndexed) != 0;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
IsAlphaPixelFormat(
|
||||
PixelFormat pixfmt
|
||||
)
|
||||
{
|
||||
return (pixfmt & PixelFormatAlpha) != 0;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
IsExtendedPixelFormat(
|
||||
PixelFormat pixfmt
|
||||
)
|
||||
{
|
||||
return (pixfmt & PixelFormatExtended) != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Determine if the Pixel Format is Canonical format:
|
||||
// PixelFormat32bppARGB
|
||||
// PixelFormat32bppPARGB
|
||||
// PixelFormat64bppARGB
|
||||
// PixelFormat64bppPARGB
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
inline BOOL
|
||||
IsCanonicalPixelFormat(
|
||||
PixelFormat pixfmt
|
||||
)
|
||||
{
|
||||
return (pixfmt & PixelFormatCanonical) != 0;
|
||||
}
|
||||
|
||||
enum PaletteFlags
|
||||
{
|
||||
PaletteFlagsHasAlpha = 0x0001,
|
||||
PaletteFlagsGrayScale = 0x0002,
|
||||
PaletteFlagsHalftone = 0x0004
|
||||
};
|
||||
|
||||
struct ColorPalette
|
||||
{
|
||||
public:
|
||||
UINT Flags; // Palette flags
|
||||
UINT Count; // Number of color entries
|
||||
ARGB Entries[1]; // Palette color entries
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,514 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusRegion.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Region class implementation
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSREGION_H
|
||||
#define _GDIPLUSREGION_H
|
||||
|
||||
inline
|
||||
Region::Region()
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegion(®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region::Region(IN const RectF& rect)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegionRect(&rect, ®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region::Region(IN const Rect& rect)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegionRectI(&rect, ®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region::Region(IN const GraphicsPath* path)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegionPath(path->nativePath, ®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region::Region(IN const BYTE* regionData, IN INT size)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegionRgnData(regionData, size,
|
||||
®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region::Region(IN HRGN hRgn)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
lastResult = DllExports::GdipCreateRegionHrgn(hRgn, ®ion);
|
||||
|
||||
SetNativeRegion(region);
|
||||
}
|
||||
|
||||
inline
|
||||
Region* Region::FromHRGN(IN HRGN hRgn)
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
if (DllExports::GdipCreateRegionHrgn(hRgn, ®ion) == Ok)
|
||||
{
|
||||
Region* newRegion = new Region(region);
|
||||
|
||||
if (newRegion == NULL)
|
||||
{
|
||||
DllExports::GdipDeleteRegion(region);
|
||||
}
|
||||
|
||||
return newRegion;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline
|
||||
Region::~Region()
|
||||
{
|
||||
DllExports::GdipDeleteRegion(nativeRegion);
|
||||
}
|
||||
|
||||
inline Region*
|
||||
Region::Clone() const
|
||||
{
|
||||
GpRegion *region = NULL;
|
||||
|
||||
SetStatus(DllExports::GdipCloneRegion(nativeRegion, ®ion));
|
||||
|
||||
return new Region(region);
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::MakeInfinite()
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetInfinite(nativeRegion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::MakeEmpty()
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetEmpty(nativeRegion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Intersect(IN const RectF& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect,
|
||||
CombineModeIntersect));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Intersect(IN const Rect& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect,
|
||||
CombineModeIntersect));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Intersect(IN const GraphicsPath* path)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion,
|
||||
path->nativePath,
|
||||
CombineModeIntersect));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Intersect(IN const Region* region)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
CombineModeIntersect));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Union(IN const RectF& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect,
|
||||
CombineModeUnion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Union(IN const Rect& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect,
|
||||
CombineModeUnion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Union(IN const GraphicsPath* path)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion,
|
||||
path->nativePath,
|
||||
CombineModeUnion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Union(IN const Region* region)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
CombineModeUnion));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Xor(IN const RectF& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect,
|
||||
CombineModeXor));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Xor(IN const Rect& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect,
|
||||
CombineModeXor));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Xor(IN const GraphicsPath* path)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion,
|
||||
path->nativePath,
|
||||
CombineModeXor));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Xor(IN const Region* region)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
CombineModeXor));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Exclude(IN const RectF& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect,
|
||||
CombineModeExclude));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Exclude(IN const Rect& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect,
|
||||
CombineModeExclude));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Exclude(IN const GraphicsPath* path)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion,
|
||||
path->nativePath,
|
||||
CombineModeExclude));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Exclude(IN const Region* region)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
CombineModeExclude));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Complement(IN const RectF& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect,
|
||||
CombineModeComplement));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Complement(IN const Rect& rect)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect,
|
||||
CombineModeComplement));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Complement(IN const GraphicsPath* path)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion,
|
||||
path->nativePath,
|
||||
CombineModeComplement));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Complement(IN const Region* region)
|
||||
{
|
||||
return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
CombineModeComplement));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Translate(IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateRegion(nativeRegion, dx, dy));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Translate(IN INT dx,
|
||||
IN INT dy)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTranslateRegionI(nativeRegion, dx, dy));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::Transform(IN const Matrix* matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformRegion(nativeRegion,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::GetBounds(OUT RectF* rect,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetRegionBounds(nativeRegion,
|
||||
g->nativeGraphics,
|
||||
rect));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::GetBounds(OUT Rect* rect,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetRegionBoundsI(nativeRegion,
|
||||
g->nativeGraphics,
|
||||
rect));
|
||||
}
|
||||
|
||||
inline HRGN
|
||||
Region::GetHRGN(IN const Graphics* g) const
|
||||
{
|
||||
HRGN hrgn;
|
||||
|
||||
SetStatus(DllExports::GdipGetRegionHRgn(nativeRegion,
|
||||
g->nativeGraphics,
|
||||
&hrgn));
|
||||
|
||||
return hrgn;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::IsEmpty(IN const Graphics *g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsEmptyRegion(nativeRegion,
|
||||
g->nativeGraphics,
|
||||
&booln));
|
||||
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::IsInfinite(IN const Graphics *g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsInfiniteRegion(nativeRegion,
|
||||
g->nativeGraphics,
|
||||
&booln));
|
||||
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::Equals(IN const Region* region,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsEqualRegion(nativeRegion,
|
||||
region->nativeRegion,
|
||||
g->nativeGraphics,
|
||||
&booln));
|
||||
return booln;
|
||||
}
|
||||
|
||||
// Get the size of the buffer needed for the GetData method
|
||||
inline UINT
|
||||
Region::GetDataSize() const
|
||||
{
|
||||
UINT bufferSize = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetRegionDataSize(nativeRegion, &bufferSize));
|
||||
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
// buffer - where to put the data
|
||||
// bufferSize - how big the buffer is (should be at least as big as GetDataSize())
|
||||
// sizeFilled - if not NULL, this is an OUT param that says how many bytes
|
||||
// of data were written to the buffer.
|
||||
inline Status
|
||||
Region::GetData(OUT BYTE* buffer,
|
||||
IN UINT bufferSize,
|
||||
OUT UINT* sizeFilled) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetRegionData(nativeRegion, buffer,
|
||||
bufferSize, sizeFilled));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hit testing operations
|
||||
*/
|
||||
inline BOOL
|
||||
Region::IsVisible(IN const PointF& point,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsVisibleRegionPoint(nativeRegion,
|
||||
point.X, point.Y,
|
||||
(g == NULL) ? NULL : g->nativeGraphics,
|
||||
&booln));
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::IsVisible(IN const RectF& rect,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsVisibleRegionRect(nativeRegion, rect.X,
|
||||
rect.Y, rect.Width,
|
||||
rect.Height,
|
||||
(g == NULL) ?
|
||||
NULL : g->nativeGraphics,
|
||||
&booln));
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::IsVisible(IN const Point& point,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
|
||||
SetStatus(DllExports::GdipIsVisibleRegionPointI(nativeRegion,
|
||||
point.X,
|
||||
point.Y,
|
||||
(g == NULL)
|
||||
? NULL : g->nativeGraphics,
|
||||
&booln));
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline BOOL
|
||||
Region::IsVisible(IN const Rect& rect,
|
||||
IN const Graphics* g) const
|
||||
{
|
||||
BOOL booln = FALSE;
|
||||
|
||||
SetStatus(DllExports::GdipIsVisibleRegionRectI(nativeRegion,
|
||||
rect.X,
|
||||
rect.Y,
|
||||
rect.Width,
|
||||
rect.Height,
|
||||
(g == NULL)
|
||||
? NULL : g->nativeGraphics,
|
||||
&booln));
|
||||
return booln;
|
||||
}
|
||||
|
||||
inline UINT
|
||||
Region::GetRegionScansCount(IN const Matrix* matrix) const
|
||||
{
|
||||
UINT count = 0;
|
||||
|
||||
SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion,
|
||||
&count,
|
||||
matrix->nativeMatrix));
|
||||
return count;
|
||||
}
|
||||
|
||||
// If rects is NULL, return the count of rects in the region.
|
||||
// Otherwise, assume rects is big enough to hold all the region rects
|
||||
// and fill them in and return the number of rects filled in.
|
||||
// The rects are returned in the units specified by the matrix
|
||||
// (which is typically a world-to-device transform).
|
||||
// Note that the number of rects returned can vary, depending on the
|
||||
// matrix that is used.
|
||||
|
||||
inline Status
|
||||
Region::GetRegionScans(
|
||||
IN const Matrix* matrix,
|
||||
OUT RectF* rects,
|
||||
IN OUT INT* count) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetRegionScans(nativeRegion,
|
||||
rects,
|
||||
count,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
inline Status
|
||||
Region::GetRegionScans(
|
||||
IN const Matrix* matrix,
|
||||
OUT Rect* rects,
|
||||
IN OUT INT* count) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion,
|
||||
rects,
|
||||
count,
|
||||
matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
inline Region::Region(GpRegion* nativeRegion)
|
||||
{
|
||||
SetNativeRegion(nativeRegion);
|
||||
}
|
||||
|
||||
inline VOID Region::SetNativeRegion(GpRegion* nativeRegion)
|
||||
{
|
||||
this->nativeRegion = nativeRegion;
|
||||
}
|
||||
|
||||
inline Status Region::GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
#endif // !_GDIPLUSREGION_H
|
|
@ -1,333 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusStringFormat.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ StringFormat class
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSSTRINGFORMAT_H
|
||||
#define _GDIPLUSSTRINGFORMAT_H
|
||||
|
||||
class StringFormat : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class Graphics;
|
||||
friend class GraphicsPath;
|
||||
|
||||
|
||||
StringFormat(
|
||||
IN INT formatFlags = 0,
|
||||
IN LANGID language = LANG_NEUTRAL
|
||||
)
|
||||
{
|
||||
nativeFormat = NULL;
|
||||
lastError = DllExports::GdipCreateStringFormat(
|
||||
formatFlags,
|
||||
language,
|
||||
&nativeFormat
|
||||
);
|
||||
}
|
||||
|
||||
static const StringFormat *GenericDefault();
|
||||
static const StringFormat *GenericTypographic();
|
||||
|
||||
StringFormat(
|
||||
IN const StringFormat *format
|
||||
)
|
||||
{
|
||||
nativeFormat = NULL;
|
||||
lastError = DllExports::GdipCloneStringFormat(
|
||||
format ? format->nativeFormat : NULL,
|
||||
&nativeFormat
|
||||
);
|
||||
}
|
||||
|
||||
StringFormat *Clone() const
|
||||
{
|
||||
GpStringFormat *clonedStringFormat = NULL;
|
||||
|
||||
lastError = DllExports::GdipCloneStringFormat(
|
||||
nativeFormat,
|
||||
&clonedStringFormat
|
||||
);
|
||||
|
||||
if (lastError == Ok)
|
||||
return new StringFormat(clonedStringFormat, lastError);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
~StringFormat()
|
||||
{
|
||||
DllExports::GdipDeleteStringFormat(nativeFormat);
|
||||
}
|
||||
|
||||
Status SetFormatFlags(IN INT flags)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatFlags(
|
||||
nativeFormat,
|
||||
flags
|
||||
));
|
||||
}
|
||||
|
||||
INT GetFormatFlags() const
|
||||
{
|
||||
INT flags;
|
||||
SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags));
|
||||
return flags;
|
||||
}
|
||||
|
||||
Status SetAlignment(IN StringAlignment align)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatAlign(
|
||||
nativeFormat,
|
||||
align
|
||||
));
|
||||
}
|
||||
|
||||
StringAlignment GetAlignment() const
|
||||
{
|
||||
StringAlignment alignment;
|
||||
SetStatus(DllExports::GdipGetStringFormatAlign(
|
||||
nativeFormat,
|
||||
&alignment
|
||||
));
|
||||
return alignment;
|
||||
}
|
||||
|
||||
Status SetLineAlignment(IN StringAlignment align)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatLineAlign(
|
||||
nativeFormat,
|
||||
align
|
||||
));
|
||||
}
|
||||
|
||||
StringAlignment GetLineAlignment() const
|
||||
{
|
||||
StringAlignment alignment;
|
||||
SetStatus(DllExports::GdipGetStringFormatLineAlign(
|
||||
nativeFormat,
|
||||
&alignment
|
||||
));
|
||||
return alignment;
|
||||
}
|
||||
|
||||
Status SetHotkeyPrefix(IN HotkeyPrefix hotkeyPrefix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix(
|
||||
nativeFormat,
|
||||
(INT)hotkeyPrefix
|
||||
));
|
||||
}
|
||||
|
||||
HotkeyPrefix GetHotkeyPrefix() const
|
||||
{
|
||||
HotkeyPrefix hotkeyPrefix;
|
||||
SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix(
|
||||
nativeFormat,
|
||||
(INT*)&hotkeyPrefix
|
||||
));
|
||||
return hotkeyPrefix;
|
||||
}
|
||||
|
||||
Status SetTabStops(
|
||||
IN REAL firstTabOffset,
|
||||
IN INT count,
|
||||
IN const REAL *tabStops
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatTabStops(
|
||||
nativeFormat,
|
||||
firstTabOffset,
|
||||
count,
|
||||
tabStops
|
||||
));
|
||||
}
|
||||
|
||||
INT GetTabStopCount() const
|
||||
{
|
||||
INT count;
|
||||
SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count));
|
||||
return count;
|
||||
}
|
||||
|
||||
Status GetTabStops(
|
||||
IN INT count,
|
||||
OUT REAL *firstTabOffset,
|
||||
OUT REAL *tabStops
|
||||
) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetStringFormatTabStops(
|
||||
nativeFormat,
|
||||
count,
|
||||
firstTabOffset,
|
||||
tabStops
|
||||
));
|
||||
}
|
||||
|
||||
Status SetDigitSubstitution(
|
||||
IN LANGID language,
|
||||
IN StringDigitSubstitute substitute
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution(
|
||||
nativeFormat,
|
||||
language,
|
||||
substitute
|
||||
));
|
||||
}
|
||||
|
||||
LANGID GetDigitSubstitutionLanguage(
|
||||
) const
|
||||
{
|
||||
LANGID language;
|
||||
SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(
|
||||
nativeFormat,
|
||||
&language,
|
||||
NULL
|
||||
));
|
||||
return language;
|
||||
}
|
||||
|
||||
StringDigitSubstitute GetDigitSubstitutionMethod(
|
||||
) const
|
||||
{
|
||||
StringDigitSubstitute substitute;
|
||||
SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(
|
||||
nativeFormat,
|
||||
NULL,
|
||||
&substitute
|
||||
));
|
||||
return substitute;
|
||||
}
|
||||
|
||||
Status SetTrimming(IN StringTrimming trimming)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatTrimming(
|
||||
nativeFormat,
|
||||
trimming
|
||||
));
|
||||
}
|
||||
|
||||
StringTrimming StringFormat::GetTrimming() const
|
||||
{
|
||||
StringTrimming trimming;
|
||||
SetStatus(DllExports::GdipGetStringFormatTrimming(
|
||||
nativeFormat,
|
||||
&trimming
|
||||
));
|
||||
return trimming;
|
||||
}
|
||||
|
||||
Status SetMeasurableCharacterRanges(
|
||||
IN INT rangeCount,
|
||||
IN const CharacterRange *ranges
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges(
|
||||
nativeFormat,
|
||||
rangeCount,
|
||||
ranges
|
||||
));
|
||||
}
|
||||
|
||||
INT GetMeasurableCharacterRangeCount()
|
||||
{
|
||||
INT count;
|
||||
SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount(
|
||||
nativeFormat,
|
||||
&count
|
||||
));
|
||||
return count;
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastError;
|
||||
lastError = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Status SetStatus(GpStatus newStatus) const
|
||||
{
|
||||
if (newStatus == Ok)
|
||||
{
|
||||
return Ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lastError = newStatus;
|
||||
}
|
||||
}
|
||||
|
||||
StringFormat(const StringFormat &source)
|
||||
{
|
||||
nativeFormat = NULL;
|
||||
lastError = DllExports::GdipCloneStringFormat(
|
||||
source.nativeFormat,
|
||||
&nativeFormat
|
||||
);
|
||||
}
|
||||
|
||||
StringFormat& operator=(const StringFormat &source)
|
||||
{
|
||||
DllExports::GdipDeleteStringFormat(nativeFormat);
|
||||
lastError = DllExports::GdipCloneStringFormat(
|
||||
source.nativeFormat,
|
||||
&nativeFormat
|
||||
);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringFormat(GpStringFormat * clonedStringFormat, Status status)
|
||||
{
|
||||
lastError = status;
|
||||
nativeFormat = clonedStringFormat;
|
||||
|
||||
}
|
||||
|
||||
GpStringFormat *nativeFormat;
|
||||
mutable Status lastError;
|
||||
};
|
||||
|
||||
static BYTE GenericTypographicStringFormatBuffer[sizeof(StringFormat)] = {0};
|
||||
static BYTE GenericDefaultStringFormatBuffer[sizeof(StringFormat)] = {0};
|
||||
|
||||
inline const StringFormat *StringFormat::GenericDefault()
|
||||
{
|
||||
StringFormat * genericDefaultStringFormat =
|
||||
(StringFormat*)GenericDefaultStringFormatBuffer;
|
||||
|
||||
genericDefaultStringFormat->lastError =
|
||||
DllExports::GdipStringFormatGetGenericDefault(
|
||||
&(genericDefaultStringFormat->nativeFormat)
|
||||
);
|
||||
|
||||
return genericDefaultStringFormat;
|
||||
}
|
||||
|
||||
inline const StringFormat *StringFormat::GenericTypographic()
|
||||
{
|
||||
StringFormat * genericTypographicStringFormat =
|
||||
(StringFormat*)GenericTypographicStringFormatBuffer;
|
||||
|
||||
genericTypographicStringFormat->lastError =
|
||||
DllExports::GdipStringFormatGetGenericTypographic(
|
||||
&genericTypographicStringFormat->nativeFormat
|
||||
);
|
||||
|
||||
return genericTypographicStringFormat;
|
||||
}
|
||||
|
||||
#endif // !_GDIPLUSSTRINGFORMAT_H
|
|
@ -1,760 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* GdiplusTypes.h
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Types
|
||||
*
|
||||
\**************************************************************************/
|
||||
|
||||
#ifndef _GDIPLUSTYPES_H
|
||||
#define _GDIPLUSTYPES_H
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Callback functions
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
extern "C" {
|
||||
typedef BOOL (CALLBACK * ImageAbort)(VOID *);
|
||||
typedef ImageAbort DrawImageAbort;
|
||||
typedef ImageAbort GetThumbnailImageAbort;
|
||||
}
|
||||
|
||||
// Callback for EnumerateMetafile methods. The parameters are:
|
||||
|
||||
// recordType WMF, EMF, or EMF+ record type
|
||||
// flags (always 0 for WMF/EMF records)
|
||||
// dataSize size of the record data (in bytes), or 0 if no data
|
||||
// data pointer to the record data, or NULL if no data
|
||||
// callbackData pointer to callbackData, if any
|
||||
|
||||
// This method can then call Metafile::PlayRecord to play the
|
||||
// record that was just enumerated. If this method returns
|
||||
// FALSE, the enumeration process is aborted. Otherwise, it continues.
|
||||
|
||||
extern "C" {
|
||||
typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Primitive data types
|
||||
//
|
||||
// NOTE:
|
||||
// Types already defined in standard header files:
|
||||
// INT8
|
||||
// UINT8
|
||||
// INT16
|
||||
// UINT16
|
||||
// INT32
|
||||
// UINT32
|
||||
// INT64
|
||||
// UINT64
|
||||
//
|
||||
// Avoid using the following types:
|
||||
// LONG - use INT
|
||||
// ULONG - use UINT
|
||||
// DWORD - use UINT32
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
typedef float REAL;
|
||||
|
||||
#define REAL_MAX FLT_MAX
|
||||
#define REAL_MIN FLT_MIN
|
||||
#define REAL_TOLERANCE (FLT_MIN * 100)
|
||||
#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Forward declarations of common classes
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Size;
|
||||
class SizeF;
|
||||
class Point;
|
||||
class PointF;
|
||||
class Rect;
|
||||
class RectF;
|
||||
class CharacterRange;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Status return values from GDI+ methods
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
enum Status
|
||||
{
|
||||
Ok = 0,
|
||||
GenericError = 1,
|
||||
InvalidParameter = 2,
|
||||
OutOfMemory = 3,
|
||||
ObjectBusy = 4,
|
||||
InsufficientBuffer = 5,
|
||||
NotImplemented = 6,
|
||||
Win32Error = 7,
|
||||
WrongState = 8,
|
||||
Aborted = 9,
|
||||
FileNotFound = 10,
|
||||
ValueOverflow = 11,
|
||||
AccessDenied = 12,
|
||||
UnknownImageFormat = 13,
|
||||
FontFamilyNotFound = 14,
|
||||
FontStyleNotFound = 15,
|
||||
NotTrueTypeFont = 16,
|
||||
UnsupportedGdiplusVersion = 17,
|
||||
GdiplusNotInitialized = 18,
|
||||
PropertyNotFound = 19,
|
||||
PropertyNotSupported = 20
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a dimension in a 2D coordinate system (floating-point coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class SizeF
|
||||
{
|
||||
public:
|
||||
SizeF()
|
||||
{
|
||||
Width = Height = 0.0f;
|
||||
}
|
||||
|
||||
SizeF(IN const SizeF& size)
|
||||
{
|
||||
Width = size.Width;
|
||||
Height = size.Height;
|
||||
}
|
||||
|
||||
SizeF(IN REAL width,
|
||||
IN REAL height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
SizeF operator+(IN const SizeF& sz) const
|
||||
{
|
||||
return SizeF(Width + sz.Width,
|
||||
Height + sz.Height);
|
||||
}
|
||||
|
||||
SizeF operator-(IN const SizeF& sz) const
|
||||
{
|
||||
return SizeF(Width - sz.Width,
|
||||
Height - sz.Height);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const SizeF& sz) const
|
||||
{
|
||||
return (Width == sz.Width) && (Height == sz.Height);
|
||||
}
|
||||
|
||||
BOOL Empty() const
|
||||
{
|
||||
return (Width == 0.0f && Height == 0.0f);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
REAL Width;
|
||||
REAL Height;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a dimension in a 2D coordinate system (integer coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Size
|
||||
{
|
||||
public:
|
||||
Size()
|
||||
{
|
||||
Width = Height = 0;
|
||||
}
|
||||
|
||||
Size(IN const Size& size)
|
||||
{
|
||||
Width = size.Width;
|
||||
Height = size.Height;
|
||||
}
|
||||
|
||||
Size(IN INT width,
|
||||
IN INT height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
Size operator+(IN const Size& sz) const
|
||||
{
|
||||
return Size(Width + sz.Width,
|
||||
Height + sz.Height);
|
||||
}
|
||||
|
||||
Size operator-(IN const Size& sz) const
|
||||
{
|
||||
return Size(Width - sz.Width,
|
||||
Height - sz.Height);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Size& sz) const
|
||||
{
|
||||
return (Width == sz.Width) && (Height == sz.Height);
|
||||
}
|
||||
|
||||
BOOL Empty() const
|
||||
{
|
||||
return (Width == 0 && Height == 0);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
INT Width;
|
||||
INT Height;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a location in a 2D coordinate system (floating-point coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class PointF
|
||||
{
|
||||
public:
|
||||
PointF()
|
||||
{
|
||||
X = Y = 0.0f;
|
||||
}
|
||||
|
||||
PointF(IN const PointF &point)
|
||||
{
|
||||
X = point.X;
|
||||
Y = point.Y;
|
||||
}
|
||||
|
||||
PointF(IN const SizeF &size)
|
||||
{
|
||||
X = size.Width;
|
||||
Y = size.Height;
|
||||
}
|
||||
|
||||
PointF(IN REAL x,
|
||||
IN REAL y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
PointF operator+(IN const PointF& point) const
|
||||
{
|
||||
return PointF(X + point.X,
|
||||
Y + point.Y);
|
||||
}
|
||||
|
||||
PointF operator-(IN const PointF& point) const
|
||||
{
|
||||
return PointF(X - point.X,
|
||||
Y - point.Y);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const PointF& point)
|
||||
{
|
||||
return (X == point.X) && (Y == point.Y);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
REAL X;
|
||||
REAL Y;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a location in a 2D coordinate system (integer coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Point
|
||||
{
|
||||
public:
|
||||
Point()
|
||||
{
|
||||
X = Y = 0;
|
||||
}
|
||||
|
||||
Point(IN const Point &point)
|
||||
{
|
||||
X = point.X;
|
||||
Y = point.Y;
|
||||
}
|
||||
|
||||
Point(IN const Size &size)
|
||||
{
|
||||
X = size.Width;
|
||||
Y = size.Height;
|
||||
}
|
||||
|
||||
Point(IN INT x,
|
||||
IN INT y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
Point operator+(IN const Point& point) const
|
||||
{
|
||||
return Point(X + point.X,
|
||||
Y + point.Y);
|
||||
}
|
||||
|
||||
Point operator-(IN const Point& point) const
|
||||
{
|
||||
return Point(X - point.X,
|
||||
Y - point.Y);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Point& point)
|
||||
{
|
||||
return (X == point.X) && (Y == point.Y);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
INT X;
|
||||
INT Y;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a rectangle in a 2D coordinate system (floating-point coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class RectF
|
||||
{
|
||||
public:
|
||||
|
||||
RectF()
|
||||
{
|
||||
X = Y = Width = Height = 0.0f;
|
||||
}
|
||||
|
||||
RectF(IN REAL x,
|
||||
IN REAL y,
|
||||
IN REAL width,
|
||||
IN REAL height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
RectF(IN const PointF& location,
|
||||
IN const SizeF& size)
|
||||
{
|
||||
X = location.X;
|
||||
Y = location.Y;
|
||||
Width = size.Width;
|
||||
Height = size.Height;
|
||||
}
|
||||
|
||||
RectF* Clone() const
|
||||
{
|
||||
return new RectF(X, Y, Width, Height);
|
||||
}
|
||||
|
||||
VOID GetLocation(OUT PointF* point) const
|
||||
{
|
||||
point->X = X;
|
||||
point->Y = Y;
|
||||
}
|
||||
|
||||
VOID GetSize(OUT SizeF* size) const
|
||||
{
|
||||
size->Width = Width;
|
||||
size->Height = Height;
|
||||
}
|
||||
|
||||
VOID GetBounds(OUT RectF* rect) const
|
||||
{
|
||||
rect->X = X;
|
||||
rect->Y = Y;
|
||||
rect->Width = Width;
|
||||
rect->Height = Height;
|
||||
}
|
||||
|
||||
REAL GetLeft() const
|
||||
{
|
||||
return X;
|
||||
}
|
||||
|
||||
REAL GetTop() const
|
||||
{
|
||||
return Y;
|
||||
}
|
||||
|
||||
REAL GetRight() const
|
||||
{
|
||||
return X+Width;
|
||||
}
|
||||
|
||||
REAL GetBottom() const
|
||||
{
|
||||
return Y+Height;
|
||||
}
|
||||
|
||||
BOOL IsEmptyArea() const
|
||||
{
|
||||
return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const RectF & rect) const
|
||||
{
|
||||
return X == rect.X &&
|
||||
Y == rect.Y &&
|
||||
Width == rect.Width &&
|
||||
Height == rect.Height;
|
||||
}
|
||||
|
||||
BOOL Contains(IN REAL x,
|
||||
IN REAL y) const
|
||||
{
|
||||
return x >= X && x < X+Width &&
|
||||
y >= Y && y < Y+Height;
|
||||
}
|
||||
|
||||
BOOL Contains(IN const PointF& pt) const
|
||||
{
|
||||
return Contains(pt.X, pt.Y);
|
||||
}
|
||||
|
||||
BOOL Contains(IN const RectF& rect) const
|
||||
{
|
||||
return (X <= rect.X) && (rect.GetRight() <= GetRight()) &&
|
||||
(Y <= rect.Y) && (rect.GetBottom() <= GetBottom());
|
||||
}
|
||||
|
||||
VOID Inflate(IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
X -= dx;
|
||||
Y -= dy;
|
||||
Width += 2*dx;
|
||||
Height += 2*dy;
|
||||
}
|
||||
|
||||
VOID Inflate(IN const PointF& point)
|
||||
{
|
||||
Inflate(point.X, point.Y);
|
||||
}
|
||||
|
||||
BOOL Intersect(IN const RectF& rect)
|
||||
{
|
||||
return Intersect(*this, *this, rect);
|
||||
}
|
||||
|
||||
static BOOL Intersect(OUT RectF& c,
|
||||
IN const RectF& a,
|
||||
IN const RectF& b)
|
||||
{
|
||||
REAL right = min(a.GetRight(), b.GetRight());
|
||||
REAL bottom = min(a.GetBottom(), b.GetBottom());
|
||||
REAL left = max(a.GetLeft(), b.GetLeft());
|
||||
REAL top = max(a.GetTop(), b.GetTop());
|
||||
|
||||
c.X = left;
|
||||
c.Y = top;
|
||||
c.Width = right - left;
|
||||
c.Height = bottom - top;
|
||||
return !c.IsEmptyArea();
|
||||
}
|
||||
|
||||
BOOL IntersectsWith(IN const RectF& rect) const
|
||||
{
|
||||
return (GetLeft() < rect.GetRight() &&
|
||||
GetTop() < rect.GetBottom() &&
|
||||
GetRight() > rect.GetLeft() &&
|
||||
GetBottom() > rect.GetTop());
|
||||
}
|
||||
|
||||
static BOOL Union(OUT RectF& c,
|
||||
IN const RectF& a,
|
||||
IN const RectF& b)
|
||||
{
|
||||
REAL right = max(a.GetRight(), b.GetRight());
|
||||
REAL bottom = max(a.GetBottom(), b.GetBottom());
|
||||
REAL left = min(a.GetLeft(), b.GetLeft());
|
||||
REAL top = min(a.GetTop(), b.GetTop());
|
||||
|
||||
c.X = left;
|
||||
c.Y = top;
|
||||
c.Width = right - left;
|
||||
c.Height = bottom - top;
|
||||
return !c.IsEmptyArea();
|
||||
}
|
||||
|
||||
VOID Offset(IN const PointF& point)
|
||||
{
|
||||
Offset(point.X, point.Y);
|
||||
}
|
||||
|
||||
VOID Offset(IN REAL dx,
|
||||
IN REAL dy)
|
||||
{
|
||||
X += dx;
|
||||
Y += dy;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
REAL X;
|
||||
REAL Y;
|
||||
REAL Width;
|
||||
REAL Height;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Represents a rectangle in a 2D coordinate system (integer coordinates)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
class Rect
|
||||
{
|
||||
public:
|
||||
|
||||
Rect()
|
||||
{
|
||||
X = Y = Width = Height = 0;
|
||||
}
|
||||
|
||||
Rect(IN INT x,
|
||||
IN INT y,
|
||||
IN INT width,
|
||||
IN INT height)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
Rect(IN const Point& location,
|
||||
IN const Size& size)
|
||||
{
|
||||
X = location.X;
|
||||
Y = location.Y;
|
||||
Width = size.Width;
|
||||
Height = size.Height;
|
||||
}
|
||||
|
||||
Rect* Clone() const
|
||||
{
|
||||
return new Rect(X, Y, Width, Height);
|
||||
}
|
||||
|
||||
VOID GetLocation(OUT Point* point) const
|
||||
{
|
||||
point->X = X;
|
||||
point->Y = Y;
|
||||
}
|
||||
|
||||
VOID GetSize(OUT Size* size) const
|
||||
{
|
||||
size->Width = Width;
|
||||
size->Height = Height;
|
||||
}
|
||||
|
||||
VOID GetBounds(OUT Rect* rect) const
|
||||
{
|
||||
rect->X = X;
|
||||
rect->Y = Y;
|
||||
rect->Width = Width;
|
||||
rect->Height = Height;
|
||||
}
|
||||
|
||||
INT GetLeft() const
|
||||
{
|
||||
return X;
|
||||
}
|
||||
|
||||
INT GetTop() const
|
||||
{
|
||||
return Y;
|
||||
}
|
||||
|
||||
INT GetRight() const
|
||||
{
|
||||
return X+Width;
|
||||
}
|
||||
|
||||
INT GetBottom() const
|
||||
{
|
||||
return Y+Height;
|
||||
}
|
||||
|
||||
BOOL IsEmptyArea() const
|
||||
{
|
||||
return (Width <= 0) || (Height <= 0);
|
||||
}
|
||||
|
||||
BOOL Equals(IN const Rect & rect) const
|
||||
{
|
||||
return X == rect.X &&
|
||||
Y == rect.Y &&
|
||||
Width == rect.Width &&
|
||||
Height == rect.Height;
|
||||
}
|
||||
|
||||
BOOL Contains(IN INT x,
|
||||
IN INT y) const
|
||||
{
|
||||
return x >= X && x < X+Width &&
|
||||
y >= Y && y < Y+Height;
|
||||
}
|
||||
|
||||
BOOL Contains(IN const Point& pt) const
|
||||
{
|
||||
return Contains(pt.X, pt.Y);
|
||||
}
|
||||
|
||||
BOOL Contains(IN Rect& rect) const
|
||||
{
|
||||
return (X <= rect.X) && (rect.GetRight() <= GetRight()) &&
|
||||
(Y <= rect.Y) && (rect.GetBottom() <= GetBottom());
|
||||
}
|
||||
|
||||
VOID Inflate(IN INT dx,
|
||||
IN INT dy)
|
||||
{
|
||||
X -= dx;
|
||||
Y -= dy;
|
||||
Width += 2*dx;
|
||||
Height += 2*dy;
|
||||
}
|
||||
|
||||
VOID Inflate(IN const Point& point)
|
||||
{
|
||||
Inflate(point.X, point.Y);
|
||||
}
|
||||
|
||||
BOOL Intersect(IN const Rect& rect)
|
||||
{
|
||||
return Intersect(*this, *this, rect);
|
||||
}
|
||||
|
||||
static BOOL Intersect(OUT Rect& c,
|
||||
IN const Rect& a,
|
||||
IN const Rect& b)
|
||||
{
|
||||
INT right = min(a.GetRight(), b.GetRight());
|
||||
INT bottom = min(a.GetBottom(), b.GetBottom());
|
||||
INT left = max(a.GetLeft(), b.GetLeft());
|
||||
INT top = max(a.GetTop(), b.GetTop());
|
||||
|
||||
c.X = left;
|
||||
c.Y = top;
|
||||
c.Width = right - left;
|
||||
c.Height = bottom - top;
|
||||
return !c.IsEmptyArea();
|
||||
}
|
||||
|
||||
BOOL IntersectsWith(IN const Rect& rect) const
|
||||
{
|
||||
return (GetLeft() < rect.GetRight() &&
|
||||
GetTop() < rect.GetBottom() &&
|
||||
GetRight() > rect.GetLeft() &&
|
||||
GetBottom() > rect.GetTop());
|
||||
}
|
||||
|
||||
static BOOL Union(OUT Rect& c,
|
||||
IN const Rect& a,
|
||||
IN const Rect& b)
|
||||
{
|
||||
INT right = max(a.GetRight(), b.GetRight());
|
||||
INT bottom = max(a.GetBottom(), b.GetBottom());
|
||||
INT left = min(a.GetLeft(), b.GetLeft());
|
||||
INT top = min(a.GetTop(), b.GetTop());
|
||||
|
||||
c.X = left;
|
||||
c.Y = top;
|
||||
c.Width = right - left;
|
||||
c.Height = bottom - top;
|
||||
return !c.IsEmptyArea();
|
||||
}
|
||||
|
||||
VOID Offset(IN const Point& point)
|
||||
{
|
||||
Offset(point.X, point.Y);
|
||||
}
|
||||
|
||||
VOID Offset(IN INT dx,
|
||||
IN INT dy)
|
||||
{
|
||||
X += dx;
|
||||
Y += dy;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
INT X;
|
||||
INT Y;
|
||||
INT Width;
|
||||
INT Height;
|
||||
};
|
||||
|
||||
class PathData
|
||||
{
|
||||
public:
|
||||
PathData()
|
||||
{
|
||||
Count = 0;
|
||||
Points = NULL;
|
||||
Types = NULL;
|
||||
}
|
||||
|
||||
~PathData()
|
||||
{
|
||||
if (Points != NULL)
|
||||
{
|
||||
delete Points;
|
||||
}
|
||||
|
||||
if (Types != NULL)
|
||||
{
|
||||
delete Types;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PathData(const PathData &);
|
||||
PathData& operator=(const PathData &);
|
||||
|
||||
public:
|
||||
INT Count;
|
||||
PointF* Points;
|
||||
BYTE* Types;
|
||||
};
|
||||
|
||||
class CharacterRange
|
||||
{
|
||||
public:
|
||||
CharacterRange(
|
||||
INT first,
|
||||
INT length
|
||||
) :
|
||||
First (first),
|
||||
Length (length)
|
||||
{}
|
||||
|
||||
CharacterRange() : First(0), Length(0)
|
||||
{}
|
||||
|
||||
CharacterRange & operator = (const CharacterRange &rhs)
|
||||
{
|
||||
First = rhs.First;
|
||||
Length = rhs.Length;
|
||||
return *this;
|
||||
}
|
||||
|
||||
INT First;
|
||||
INT Length;
|
||||
};
|
||||
|
||||
#endif // !_GDIPLUSTYPES_HPP
|
|
@ -1,377 +0,0 @@
|
|||
/**************************************************************************\
|
||||
*
|
||||
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
|
||||
*
|
||||
* Module Name:
|
||||
*
|
||||
* Image Attributes
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
* GDI+ Image Attributes used with Graphics.DrawImage
|
||||
*
|
||||
* There are 5 possible sets of color adjustments:
|
||||
* ColorAdjustDefault,
|
||||
* ColorAdjustBitmap,
|
||||
* ColorAdjustBrush,
|
||||
* ColorAdjustPen,
|
||||
* ColorAdjustText,
|
||||
*
|
||||
* Bitmaps, Brushes, Pens, and Text will all use any color adjustments
|
||||
* that have been set into the default ImageAttributes until their own
|
||||
* color adjustments have been set. So as soon as any "Set" method is
|
||||
* called for Bitmaps, Brushes, Pens, or Text, then they start from
|
||||
* scratch with only the color adjustments that have been set for them.
|
||||
* Calling Reset removes any individual color adjustments for a type
|
||||
* and makes it revert back to using all the default color adjustments
|
||||
* (if any). The SetToIdentity method is a way to force a type to
|
||||
* have no color adjustments at all, regardless of what previous adjustments
|
||||
* have been set for the defaults or for that type.
|
||||
*
|
||||
\********************************************************************F******/
|
||||
|
||||
#ifndef _GDIPLUSIMAGEATTRIBUTES_H
|
||||
#define _GDIPLUSIMAGEATTRIBUTES_H
|
||||
|
||||
class GpImageAttributes;
|
||||
|
||||
class ImageAttributes : public GdiplusBase
|
||||
{
|
||||
friend class Graphics;
|
||||
friend class TextureBrush;
|
||||
|
||||
public:
|
||||
|
||||
ImageAttributes()
|
||||
{
|
||||
nativeImageAttr = NULL;
|
||||
lastResult = DllExports::GdipCreateImageAttributes(&nativeImageAttr);
|
||||
}
|
||||
|
||||
~ImageAttributes()
|
||||
{
|
||||
DllExports::GdipDisposeImageAttributes(nativeImageAttr);
|
||||
}
|
||||
|
||||
ImageAttributes* Clone() const
|
||||
{
|
||||
GpImageAttributes* clone;
|
||||
|
||||
SetStatus(DllExports::GdipCloneImageAttributes(
|
||||
nativeImageAttr,
|
||||
&clone));
|
||||
|
||||
return new ImageAttributes(clone, lastResult);
|
||||
}
|
||||
|
||||
Status
|
||||
SetToIdentity(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesToIdentity(
|
||||
nativeImageAttr,
|
||||
type));
|
||||
}
|
||||
|
||||
Status
|
||||
Reset(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipResetImageAttributes(
|
||||
nativeImageAttr,
|
||||
type));
|
||||
}
|
||||
|
||||
Status
|
||||
SetColorMatrix(
|
||||
IN const ColorMatrix *colorMatrix,
|
||||
IN ColorMatrixFlags mode = ColorMatrixFlagsDefault,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
colorMatrix,
|
||||
NULL,
|
||||
mode));
|
||||
}
|
||||
|
||||
Status ClearColorMatrix(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
ColorMatrixFlagsDefault));
|
||||
}
|
||||
|
||||
Status
|
||||
SetColorMatrices(
|
||||
IN const ColorMatrix *colorMatrix,
|
||||
IN const ColorMatrix *grayMatrix,
|
||||
IN ColorMatrixFlags mode = ColorMatrixFlagsDefault,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
colorMatrix,
|
||||
grayMatrix,
|
||||
mode));
|
||||
}
|
||||
|
||||
Status ClearColorMatrices(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorMatrix(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL,
|
||||
ColorMatrixFlagsDefault));
|
||||
}
|
||||
|
||||
Status SetThreshold(
|
||||
IN REAL threshold,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesThreshold(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
threshold));
|
||||
}
|
||||
|
||||
Status ClearThreshold(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesThreshold(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
0.0));
|
||||
}
|
||||
|
||||
Status SetGamma(
|
||||
IN REAL gamma,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesGamma(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
gamma));
|
||||
}
|
||||
|
||||
Status ClearGamma(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesGamma(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
0.0));
|
||||
}
|
||||
|
||||
Status SetNoOp(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesNoOp(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE));
|
||||
}
|
||||
|
||||
Status ClearNoOp(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesNoOp(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE));
|
||||
}
|
||||
|
||||
Status SetColorKey(
|
||||
IN const Color& colorLow,
|
||||
IN const Color& colorHigh,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorKeys(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
colorLow.GetValue(),
|
||||
colorHigh.GetValue()));
|
||||
}
|
||||
|
||||
Status ClearColorKey(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesColorKeys(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
NULL,
|
||||
NULL));
|
||||
}
|
||||
|
||||
Status SetOutputChannel(
|
||||
IN ColorChannelFlags channelFlags,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesOutputChannel(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
channelFlags));
|
||||
}
|
||||
|
||||
Status ClearOutputChannel(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesOutputChannel(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
ColorChannelFlagsLast));
|
||||
}
|
||||
|
||||
Status SetOutputChannelColorProfile(
|
||||
IN const WCHAR *colorProfileFilename,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
colorProfileFilename));
|
||||
}
|
||||
|
||||
Status ClearOutputChannelColorProfile(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
NULL));
|
||||
}
|
||||
|
||||
Status SetRemapTable(
|
||||
IN UINT mapSize,
|
||||
IN const ColorMap *map,
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesRemapTable(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
TRUE,
|
||||
mapSize,
|
||||
map));
|
||||
}
|
||||
|
||||
Status ClearRemapTable(
|
||||
IN ColorAdjustType type = ColorAdjustTypeDefault
|
||||
)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetImageAttributesRemapTable(
|
||||
nativeImageAttr,
|
||||
type,
|
||||
FALSE,
|
||||
0,
|
||||
NULL));
|
||||
}
|
||||
|
||||
Status SetBrushRemapTable(IN UINT mapSize,
|
||||
IN const ColorMap *map)
|
||||
{
|
||||
return this->SetRemapTable(mapSize, map, ColorAdjustTypeBrush);
|
||||
}
|
||||
|
||||
Status ClearBrushRemapTable()
|
||||
{
|
||||
return this->ClearRemapTable(ColorAdjustTypeBrush);
|
||||
}
|
||||
|
||||
Status SetWrapMode(IN WrapMode wrap,
|
||||
IN const Color& color = Color(),
|
||||
IN BOOL clamp = FALSE)
|
||||
{
|
||||
ARGB argb = color.GetValue();
|
||||
|
||||
return SetStatus(DllExports::GdipSetImageAttributesWrapMode(
|
||||
nativeImageAttr, wrap, argb, clamp));
|
||||
}
|
||||
|
||||
// The flags of the palette are ignored.
|
||||
|
||||
Status GetAdjustedPalette(IN OUT ColorPalette* colorPalette,
|
||||
IN ColorAdjustType colorAdjustType) const
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetImageAttributesAdjustedPalette(
|
||||
nativeImageAttr, colorPalette, colorAdjustType));
|
||||
}
|
||||
|
||||
Status GetLastStatus() const
|
||||
{
|
||||
Status lastStatus = lastResult;
|
||||
lastResult = Ok;
|
||||
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
private:
|
||||
ImageAttributes(const ImageAttributes &);
|
||||
ImageAttributes& operator=(const ImageAttributes &);
|
||||
|
||||
protected:
|
||||
ImageAttributes(GpImageAttributes* imageAttr, Status status)
|
||||
{
|
||||
SetNativeImageAttr(imageAttr);
|
||||
lastResult = status;
|
||||
}
|
||||
|
||||
VOID SetNativeImageAttr(GpImageAttributes* nativeImageAttr)
|
||||
{
|
||||
this->nativeImageAttr = nativeImageAttr;
|
||||
}
|
||||
|
||||
Status SetStatus(Status status) const
|
||||
{
|
||||
if (status != Ok)
|
||||
return (lastResult = status);
|
||||
else
|
||||
return status;
|
||||
}
|
||||
|
||||
protected:
|
||||
GpImageAttributes* nativeImageAttr;
|
||||
mutable Status lastResult;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,413 +0,0 @@
|
|||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC (-1)
|
||||
#endif
|
||||
|
||||
#define IDM_OPEN 101
|
||||
#define IDM_QUIT 102
|
||||
#define IDC_FERMER 103
|
||||
#define IDD_DESASSEMBLEUR_VIEWER7 103
|
||||
#define IDC_STEP 104
|
||||
#define IDD_MEM_VIEWER7 104
|
||||
#define IDC_SETPNUM 105
|
||||
#define IDD_CONFIG 105
|
||||
#define IDC_SCROLLER 106
|
||||
#define IDD_SOUNDSETTINGS 106
|
||||
#define IDC_GO 107
|
||||
#define IDC_AUTO_UPDATE 108
|
||||
#define IDM_MEMORY 109
|
||||
#define IDM_DISASSEMBLER 110
|
||||
#define IDC_AUTO_UPDATE2 111
|
||||
#define IDD_3DSETTINGS 111
|
||||
#define IDM_GAME_INFO 111
|
||||
#define IDD_GBASLOT 113
|
||||
#define IDM_PAUSE 113
|
||||
#define IDD_GBASLOT_CFLASH 114
|
||||
#define IDM_RESET 114
|
||||
#define IDD_CHEAT_SEARCH_VIEW 115
|
||||
#define IDM_IOREG 115
|
||||
#define IDD_CHEAT_LIST 116
|
||||
#define IDD_CHEAT_ADD 117
|
||||
#define IDM_PAL 117
|
||||
#define IDM_TILE 118
|
||||
#define IDM_MAP 119
|
||||
#define IDM_MBG0 120
|
||||
#define IDM_MBG1 121
|
||||
#define IDM_MBG2 122
|
||||
#define IDM_MBG3 123
|
||||
#define IDM_SBG0 124
|
||||
#define IDM_SBG1 125
|
||||
#define IDM_SBG2 126
|
||||
#define IDM_SBG3 127
|
||||
#define IDM_OAM 128
|
||||
#define IDM_PRINTSCREEN 129
|
||||
#define IDM_QUICK_PRINTSCREEN 130
|
||||
#define IDM_SOUNDSETTINGS 131
|
||||
#define IDM_WEBSITE 132
|
||||
#define IDM_FORUM 133
|
||||
#define IDM_SUBMITBUGREPORT 134
|
||||
#define IDM_STATE_LOAD 135
|
||||
#define IDM_STATE_SAVE 136
|
||||
#define IDR_MAIN_ACCEL 137
|
||||
#define IDM_STATE_SAVE_F1 140
|
||||
#define IDM_STATE_SAVE_F2 141
|
||||
#define IDM_STATE_SAVE_F3 142
|
||||
#define IDM_STATE_SAVE_F4 143
|
||||
#define IDM_STATE_SAVE_F5 144
|
||||
#define IDM_STATE_SAVE_F6 145
|
||||
#define IDM_STATE_SAVE_F7 146
|
||||
#define IDM_STATE_SAVE_F8 147
|
||||
#define IDM_STATE_SAVE_F9 148
|
||||
#define IDM_STATE_SAVE_F10 149
|
||||
#define IDM_STATE_LOAD_F1 150
|
||||
#define IDM_STATE_LOAD_F2 151
|
||||
#define IDM_STATE_LOAD_F3 152
|
||||
#define IDM_STATE_LOAD_F4 153
|
||||
#define IDM_STATE_LOAD_F5 154
|
||||
#define IDM_STATE_LOAD_F6 155
|
||||
#define IDM_STATE_LOAD_F7 156
|
||||
#define IDM_STATE_LOAD_F8 157
|
||||
#define IDM_STATE_LOAD_F9 158
|
||||
#define IDM_STATE_LOAD_F10 159
|
||||
#define IDC_COMBO1 160
|
||||
#define IDC_COMBO2 161
|
||||
#define IDC_COMBO3 162
|
||||
#define IDC_COMBO4 163
|
||||
#define IDC_COMBO5 164
|
||||
#define IDC_COMBO6 165
|
||||
#define IDC_COMBO7 166
|
||||
#define IDC_COMBO8 167
|
||||
#define IDC_COMBO9 168
|
||||
#define IDC_COMBO10 169
|
||||
#define IDC_COMBO11 170
|
||||
#define IDC_COMBO12 171
|
||||
#define IDC_BUTTON1 173
|
||||
#define IDM_CONFIG 180
|
||||
#define IDD_INPUT 181
|
||||
#define IDC_SAVETYPE1 182
|
||||
#define IDC_SAVETYPE2 183
|
||||
#define IDC_SAVETYPE3 184
|
||||
#define IDC_SAVETYPE4 185
|
||||
#define IDC_SAVETYPE5 186
|
||||
#define IDC_SAVETYPE6 187
|
||||
#define IDC_FRAMESKIPAUTO 190
|
||||
#define IDC_FRAMESKIP0 191
|
||||
#define IDC_FRAMESKIP1 192
|
||||
#define IDC_FRAMESKIP2 193
|
||||
#define IDC_FRAMESKIP3 194
|
||||
#define IDC_FRAMESKIP4 195
|
||||
#define IDC_FRAMESKIP5 196
|
||||
#define IDC_FRAMESKIP6 197
|
||||
#define IDC_FRAMESKIP7 198
|
||||
#define IDC_FRAMESKIP8 199
|
||||
#define IDC_FRAMESKIP9 200
|
||||
#define IDM_IMPORTBACKUPMEMORY 201
|
||||
#define IDC_LANGENGLISH 210
|
||||
#define IDC_LANGFRENCH 211
|
||||
#define IDC_LANGDANISH 212
|
||||
#define IDC_8_BIT 302
|
||||
#define IDC_16_BIT 303
|
||||
#define IDC_32_BIT 304
|
||||
#define IDC_MEM_BOX 305
|
||||
#define IDC_GOTOMEM 306
|
||||
#define IDC_DES_BOX 402
|
||||
#define IDC_R0 403
|
||||
#define IDC_R1 404
|
||||
#define IDC_R2 405
|
||||
#define IDC_R3 406
|
||||
#define IDC_R4 407
|
||||
#define IDC_R5 408
|
||||
#define IDC_R6 409
|
||||
#define IDC_R7 410
|
||||
#define IDC_R8 411
|
||||
#define IDC_R9 412
|
||||
#define IDC_R10 413
|
||||
#define IDC_R11 414
|
||||
#define IDC_R12 415
|
||||
#define IDC_R13 416
|
||||
#define IDC_R14 417
|
||||
#define IDC_R15 418
|
||||
#define IDC_MODE 419
|
||||
#define IDC_AUTO_DES 420
|
||||
#define IDC_ARM 421
|
||||
#define IDC_THUMB 422
|
||||
#define IDC_GOTODES 423
|
||||
#define IDC_TMP 424
|
||||
#define IDD_GAME_INFO 501
|
||||
#define IDC_NOM_JEU 502
|
||||
#define IDC_CDE 503
|
||||
#define IDC_FAB 504
|
||||
#define IDC_TAILLE 505
|
||||
#define IDC_ARM9_T 506
|
||||
#define IDC_ARM7_T 507
|
||||
#define IDC_DATA 508
|
||||
#define IDD_IO_REG 601
|
||||
#define IDD_PAL 703
|
||||
#define IDD_TILE 704
|
||||
#define IDC_PAL_SELECT 705
|
||||
#define IDC_PALNUM 706
|
||||
#define IDC_MEM_SELECT 707
|
||||
#define IDC_Tile_BOX 708
|
||||
#define IDC_BITMAP 709
|
||||
#define IDC_256COUL 710
|
||||
#define IDC_16COUL 711
|
||||
#define IDC_MINI_TILE 712
|
||||
#define IDC_TILENUM 713
|
||||
#define IDD_MAP 800
|
||||
#define IDC_BG_SELECT 801
|
||||
#define IDC_PAL 803
|
||||
#define IDC_PRIO 804
|
||||
#define IDC_CHAR 805
|
||||
#define IDC_SCR 806
|
||||
#define IDC_MSIZE 807
|
||||
#define IDC_SCROLL 808
|
||||
#define IDD_OAM 900
|
||||
#define IDC_SCR_SELECT 901
|
||||
#define IDC_TILE 902
|
||||
#define IDC_OAMNUM 903
|
||||
#define IDC_COOR 904
|
||||
#define IDC_DIM 905
|
||||
#define IDC_ROT 906
|
||||
#define IDC_MOS 907
|
||||
#define IDC_PROP0 908
|
||||
#define IDC_PROP1 909
|
||||
#define IDD_BGMAP_VIEWER 911
|
||||
#define IDB_BGTILES 913
|
||||
#define IDC_BGMAP_SEL 1000
|
||||
#define IDC_EDIT03 1000
|
||||
#define IDC_SOUNDCORECB 1000
|
||||
#define IDC_BGMAP_BGXCNT 1001
|
||||
#define IDC_EDIT01 1001
|
||||
#define IDC_SOUNDBUFFERET 1001
|
||||
#define IDC_EDIT05 1002
|
||||
#define IDC_SLVOLUME 1002
|
||||
#define IDC_BGMAP_TYPE 1003
|
||||
#define IDC_EDIT08 1003
|
||||
#define IDC_ROTATE0 1003
|
||||
#define IDC_EDIT11 1004
|
||||
#define IDC_ROTATE90 1004
|
||||
#define IDC_EDIT07 1005
|
||||
#define IDC_ROTATE180 1005
|
||||
#define IDC_EDIT12 1006
|
||||
#define IDC_ROTATE270 1006
|
||||
#define IDC_EDIT06 1007
|
||||
#define IDC_EDIT09 1008
|
||||
#define IDC_EDIT10 1009
|
||||
#define IDC_FORCERATIO 1009
|
||||
#define IDC_AUTO_UPDATE_SPIN 1010
|
||||
#define IDC_EDIT15 1010
|
||||
#define IDC_WINDOW1X 1010
|
||||
#define IDC_AUTO_UPDATE_SECS 1011
|
||||
#define IDC_WINDOW2X 1011
|
||||
#define IDC_REFRESH 1012
|
||||
#define IDC_WINDOW3X 1012
|
||||
#define IDC_EDIT02 1013
|
||||
#define IDC_WINDOW4X 1013
|
||||
#define IDC_EDIT04 1014
|
||||
#define IDC_BGMAP_CHARBASE 1016
|
||||
#define IDC_BGMAP_SCRBASE 1017
|
||||
#define IDC_AUTOUPDATE_ASM 1018
|
||||
#define IDC_BGMAP_PRIO 1018
|
||||
#define IDC_BGMAP_PAL 1019
|
||||
#define IDC_VISIBLE 1019
|
||||
#define IDC_BGMAP_SIZE 1020
|
||||
#define IDC_IPCFIFO9 1020
|
||||
#define IDC_BGMAP_SCROLL 1021
|
||||
#define IDC_IPCSYNC9 1021
|
||||
#define IDC_IF9 1022
|
||||
#define IDC_INTHAND9 1023
|
||||
#define IDC_IE9 1024
|
||||
#define IDC_BGMAP_MOSAIC 1025
|
||||
#define IDC_DISPCNTA9 1025
|
||||
#define IDC_BGMAP_SPECEFF 1026
|
||||
#define IDC_DISPSTATA9 1026
|
||||
#define IDC_BGMAP_WINDOWS 1027
|
||||
#define IDC_DEFAULT 1027
|
||||
#define IDC_DISPCNTB9 1027
|
||||
#define IDC_3DCORE 1028
|
||||
#define IDC_DISPSTATB9 1028
|
||||
#define IDC_IME9 1029
|
||||
#define IDC_TXT_COMPILED 1029
|
||||
#define IDC_GXSTAT9 1030
|
||||
#define IDC_TXT_VERSION 1030
|
||||
#define IDC_IE7 1032
|
||||
#define IDC_ADDONS_LIST 1033
|
||||
#define IDC_IF7 1033
|
||||
#define IDC_ADDONS_INFO 1034
|
||||
#define IDC_IME7 1034
|
||||
#define IDC_BBROWSE 1035
|
||||
#define IDC_IPCSYNC7 1035
|
||||
#define IDC_IPCFIFO7 1036
|
||||
#define IDC_PATHIMG 1036
|
||||
#define IDC_PATH 1037
|
||||
#define IDC_PATHGAME 1037
|
||||
#define IDC_RFILE 1038
|
||||
#define IDC_RFOLDER 1039
|
||||
#define IDC_BBROWSE2 1040
|
||||
#define IDC_PATHDESMUME 1041
|
||||
#define IDC_BRESTART 1042
|
||||
#define IDC_BVIEW 1043
|
||||
#define IDC_BSEARCH 1044
|
||||
#define IDC_RADIO1 1045
|
||||
#define IDC_RADIO2 1046
|
||||
#define IDC_RADIO3 1047
|
||||
#define IDC_RADIO4 1048
|
||||
#define IDC_RADIO5 1049
|
||||
#define IDC_RADIO6 1050
|
||||
#define IDC_RADIO7 1051
|
||||
#define IDC_RADIO8 1052
|
||||
#define IDC_LIST1 1056
|
||||
#define IDC_BADD_AR 1057
|
||||
#define IDC_BADD_CB 1058
|
||||
#define IDC_BREMOVE 1060
|
||||
#define IDC_BEDIT 1061
|
||||
#define IDC_STATIC_S1 1061
|
||||
#define IDC_STATIC_S2 1062
|
||||
#define IDC_STATIC_S3 1063
|
||||
#define IDC_STATIC_S4 1064
|
||||
#define IDC_EVALUE 1065
|
||||
#define IDC_STATIC_RANGE 1066
|
||||
#define IDC_BADD 1068
|
||||
#define IDC_LIST 1069
|
||||
#define IDC_SNUMBER 1071
|
||||
#define IDC_CHECK1 1074
|
||||
#define IDC_RADIO9 1075
|
||||
#define IDM_FIRMSETTINGS 1100
|
||||
#define IDD_FIRMSETTINGS 1101
|
||||
#define IDC_EDIT1 1102
|
||||
#define IDC_EDIT2 1103
|
||||
#define IDC_EDIT13 1104
|
||||
#define IDC_EDIT3 1104
|
||||
#define IDC_EDIT14 1105
|
||||
#define IDD_MATRIX_VIEWER 1200
|
||||
#define IDM_MATRIX_VIEWER 1200
|
||||
#define IDC_MATRIX_VIEWER_COORD_GROUP 1201
|
||||
#define IDC_MATRIX_VIEWER_COORD_COMBO 1202
|
||||
#define IDC_MATRIX_VIEWER_COORD_11_EDIT 1203
|
||||
#define IDC_MATRIX_VIEWER_COORD_12_EDIT 1204
|
||||
#define IDC_MATRIX_VIEWER_COORD_13_EDIT 1205
|
||||
#define IDC_MATRIX_VIEWER_COORD_14_EDIT 1206
|
||||
#define IDC_MATRIX_VIEWER_COORD_21_EDIT 1207
|
||||
#define IDC_MATRIX_VIEWER_COORD_22_EDIT 1208
|
||||
#define IDC_MATRIX_VIEWER_COORD_23_EDIT 1209
|
||||
#define IDC_MATRIX_VIEWER_COORD_24_EDIT 1210
|
||||
#define IDC_MATRIX_VIEWER_COORD_31_EDIT 1211
|
||||
#define IDC_MATRIX_VIEWER_COORD_32_EDIT 1212
|
||||
#define IDC_MATRIX_VIEWER_COORD_33_EDIT 1213
|
||||
#define IDC_MATRIX_VIEWER_COORD_34_EDIT 1214
|
||||
#define IDC_MATRIX_VIEWER_COORD_41_EDIT 1215
|
||||
#define IDC_MATRIX_VIEWER_COORD_42_EDIT 1216
|
||||
#define IDC_MATRIX_VIEWER_COORD_43_EDIT 1217
|
||||
#define IDC_MATRIX_VIEWER_COORD_44_EDIT 1218
|
||||
#define IDC_MATRIX_VIEWER_DIR_GROUP 1221
|
||||
#define IDC_MATRIX_VIEWER_DIR_COMBO 1222
|
||||
#define IDC_MATRIX_VIEWER_DIR_11_EDIT 1223
|
||||
#define IDC_MATRIX_VIEWER_DIR_12_EDIT 1224
|
||||
#define IDC_MATRIX_VIEWER_DIR_13_EDIT 1225
|
||||
#define IDC_MATRIX_VIEWER_DIR_14_EDIT 1226
|
||||
#define IDC_MATRIX_VIEWER_DIR_21_EDIT 1227
|
||||
#define IDC_MATRIX_VIEWER_DIR_22_EDIT 1228
|
||||
#define IDC_MATRIX_VIEWER_DIR_23_EDIT 1229
|
||||
#define IDC_MATRIX_VIEWER_DIR_24_EDIT 1230
|
||||
#define IDC_MATRIX_VIEWER_DIR_31_EDIT 1231
|
||||
#define IDC_MATRIX_VIEWER_DIR_32_EDIT 1232
|
||||
#define IDC_MATRIX_VIEWER_DIR_33_EDIT 1233
|
||||
#define IDC_MATRIX_VIEWER_DIR_34_EDIT 1234
|
||||
#define IDC_MATRIX_VIEWER_DIR_41_EDIT 1235
|
||||
#define IDC_MATRIX_VIEWER_DIR_42_EDIT 1236
|
||||
#define IDC_MATRIX_VIEWER_DIR_43_EDIT 1237
|
||||
#define IDC_MATRIX_VIEWER_DIR_44_EDIT 1238
|
||||
#define IDC_MATRIX_VIEWER_PROJ_GROUP 1241
|
||||
#define IDC_MATRIX_VIEWER_PROJ_11_EDIT 1243
|
||||
#define IDC_MATRIX_VIEWER_PROJ_12_EDIT 1244
|
||||
#define IDC_MATRIX_VIEWER_PROJ_13_EDIT 1245
|
||||
#define IDC_MATRIX_VIEWER_PROJ_14_EDIT 1246
|
||||
#define IDC_MATRIX_VIEWER_PROJ_21_EDIT 1247
|
||||
#define IDC_MATRIX_VIEWER_PROJ_22_EDIT 1248
|
||||
#define IDC_MATRIX_VIEWER_PROJ_23_EDIT 1249
|
||||
#define IDC_MATRIX_VIEWER_PROJ_24_EDIT 1250
|
||||
#define IDC_MATRIX_VIEWER_PROJ_31_EDIT 1251
|
||||
#define IDC_MATRIX_VIEWER_PROJ_32_EDIT 1252
|
||||
#define IDC_MATRIX_VIEWER_PROJ_33_EDIT 1253
|
||||
#define IDC_MATRIX_VIEWER_PROJ_34_EDIT 1254
|
||||
#define IDC_MATRIX_VIEWER_PROJ_41_EDIT 1255
|
||||
#define IDC_MATRIX_VIEWER_PROJ_42_EDIT 1256
|
||||
#define IDC_MATRIX_VIEWER_PROJ_43_EDIT 1257
|
||||
#define IDC_MATRIX_VIEWER_PROJ_44_EDIT 1258
|
||||
#define IDC_MATRIX_VIEWER_TEX_GROUP 1261
|
||||
#define IDC_MATRIX_VIEWER_TEX_11_EDIT 1263
|
||||
#define IDC_MATRIX_VIEWER_TEX_12_EDIT 1264
|
||||
#define IDC_MATRIX_VIEWER_TEX_13_EDIT 1265
|
||||
#define IDC_MATRIX_VIEWER_TEX_14_EDIT 1266
|
||||
#define IDC_MATRIX_VIEWER_TEX_21_EDIT 1267
|
||||
#define IDC_MATRIX_VIEWER_TEX_22_EDIT 1268
|
||||
#define IDC_MATRIX_VIEWER_TEX_23_EDIT 1269
|
||||
#define IDC_MATRIX_VIEWER_TEX_24_EDIT 1270
|
||||
#define IDC_MATRIX_VIEWER_TEX_31_EDIT 1271
|
||||
#define IDC_MATRIX_VIEWER_TEX_32_EDIT 1272
|
||||
#define IDC_MATRIX_VIEWER_TEX_33_EDIT 1273
|
||||
#define IDC_MATRIX_VIEWER_TEX_34_EDIT 1274
|
||||
#define IDC_MATRIX_VIEWER_TEX_41_EDIT 1275
|
||||
#define IDC_MATRIX_VIEWER_TEX_42_EDIT 1276
|
||||
#define IDC_MATRIX_VIEWER_TEX_43_EDIT 1277
|
||||
#define IDC_MATRIX_VIEWER_TEX_44_EDIT 1278
|
||||
#define IDD_LIGHT_VIEWER 1300
|
||||
#define IDM_LIGHT_VIEWER 1300
|
||||
#define IDC_LIGHT_VIWER_LIGHT0_GROUP 1301
|
||||
#define IDD_ABOUT_BOX 1301
|
||||
#define IDC_AUTHORS_LIST 1302
|
||||
#define IDC_LIGHT_VIEWER_LIGHT0COLOR_COLORCTRL 1302
|
||||
#define IDD_DESASSEMBLEUR_VIEWER9 1302
|
||||
#define IDC_LIGHT_VIEWER_LIGHT0COLOR_EDIT 1303
|
||||
#define IDD_MEM_VIEWER9 1303
|
||||
#define IDC_LIGHT_VIEWER_LIGHT0VECTOR_EDIT 1304
|
||||
#define IDD_GBASLOT_NONE 1304
|
||||
#define IDD_GBASLOT_RUMBLEPAK 1305
|
||||
#define IDD_GBASLOT_GBAGAME 1306
|
||||
#define IDD_CHEAT_SEARCH_COMP 1307
|
||||
#define IDD_CHEAT_SEARCH_MAIN 1308
|
||||
#define IDD_CHEAT_SEARCH_RESULT 1310
|
||||
#define IDC_LIGHT_VIWER_LIGHT1_GROUP 1311
|
||||
#define IDD_CHEAT_SEARCH_EXACT 1311
|
||||
#define IDC_LIGHT_VIEWER_LIGHT1COLOR_COLORCTRL 1312
|
||||
#define IDD_CHEAT_SEARCH 1312
|
||||
#define IDC_LIGHT_VIEWER_LIGHT1COLOR_EDIT 1313
|
||||
#define IDD_CHEAT_ADD_AR_CODE 1313
|
||||
#define IDC_LIGHT_VIEWER_LIGHT1VECTOR_EDIT 1314
|
||||
#define IDD_CHEAT_ADD_BC_CODE 1314
|
||||
#define IDC_LIGHT_VIWER_LIGHT2_GROUP 1321
|
||||
#define IDC_LIGHT_VIEWER_LIGHT2COLOR_COLORCTRL 1322
|
||||
#define IDC_LIGHT_VIEWER_LIGHT2COLOR_EDIT 1323
|
||||
#define IDC_LIGHT_VIEWER_LIGHT2VECTOR_EDIT 1324
|
||||
#define IDC_LIGHT_VIWER_LIGHT3_GROUP 1331
|
||||
#define IDC_LIGHT_VIEWER_LIGHT3COLOR_COLORCTRL 1332
|
||||
#define IDC_LIGHT_VIEWER_LIGHT3COLOR_EDIT 1333
|
||||
#define IDC_LIGHT_VIEWER_LIGHT3VECTOR_EDIT 1334
|
||||
#define IDM_ABOUT 40003
|
||||
#define ACCEL_P 40004
|
||||
#define ACCEL_SPACEBAR 40005
|
||||
#define ACCEL_N 40007
|
||||
#define ID_VIEW_FRAMECOUNTER 40009
|
||||
#define ID_VIEW_DISPLAYFPS 40010
|
||||
#define IDM_FILE_RECORDAVI 40015
|
||||
#define IDM_FILE_STOPAVI 40016
|
||||
#define ACCEL_I 40018
|
||||
#define ACCEL_0 40020
|
||||
#define ACCEL_1 40021
|
||||
#define ACCEL_3 40023
|
||||
#define ACCEL_2 40024
|
||||
#define ACCEL_4 40025
|
||||
#define ACCEL_5 40026
|
||||
#define ACCEL_6 40027
|
||||
#define ACCEL_7 40028
|
||||
#define ACCEL_8 40029
|
||||
#define ACCEL_9 40030
|
||||
#define ACCEL_CTRL_O 40032
|
||||
#define ID_FILE_RECENTROM 40034
|
||||
#define IDC_SAVETYPE7 40037
|
||||
#define IDM_DEFSIZE 40038
|
||||
#define IDM_3DCONFIG 40040
|
||||
#define IDM_GBASLOT 40042
|
||||
#define IDM_CHEATS_LIST 40050
|
||||
#define IDC_BGMAP_ROTSCALEPARAMS 40051
|
||||
#define IDM_CHEATS_SEARCH 40051
|
||||
#define IDC_BGMAP_ROTSCALE 40052
|
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,6 @@ libdesmume_a_SOURCES = \
|
|||
softrender_v3sysfont.h softrender_desmumefont.h \
|
||||
matrix.cpp matrix.h \
|
||||
gfx3d.cpp gfx3d.h \
|
||||
texcache.cpp texcache.h \
|
||||
thumb_instructions.cpp thumb_instructions.h types.h \
|
||||
shaders.h \
|
||||
movie.cpp movie.h \
|
||||
|
@ -48,8 +47,7 @@ libdesmume_a_SOURCES = \
|
|||
addons.cpp addons.h \
|
||||
addons/compactFlash.cpp addons/gbagame.cpp addons/none.cpp addons/rumblepak.cpp \
|
||||
mic.cpp mic.h \
|
||||
cheatSystem.cpp cheatSystem.h \
|
||||
texcache.cpp texcache.h rasterize.cpp rasterize.h
|
||||
cheatSystem.cpp cheatSystem.h
|
||||
if HAVE_GDB_STUB
|
||||
libdesmume_a_SOURCES += gdbstub.h
|
||||
endif
|
|
@ -27,6 +27,8 @@
|
|||
#include "OGLRender.h"
|
||||
#include "debug.h"
|
||||
|
||||
//#define DEBUG_DUMP_TEXTURE
|
||||
|
||||
bool (*oglrender_init)() = 0;
|
||||
bool (*oglrender_beginOpenGL)() = 0;
|
||||
void (*oglrender_endOpenGL)() = 0;
|
||||
|
@ -67,8 +69,123 @@ static void ENDGL() {
|
|||
#include "gfx3d.h"
|
||||
|
||||
#include "shaders.h"
|
||||
#include "texcache.h"
|
||||
|
||||
//This class represents a number of regions of memory which should be viewed as contiguous
|
||||
class MemSpan
|
||||
{
|
||||
public:
|
||||
static const int MAXSIZE = 8;
|
||||
|
||||
MemSpan()
|
||||
: numItems(0)
|
||||
{}
|
||||
|
||||
int numItems;
|
||||
|
||||
struct Item {
|
||||
u32 start;
|
||||
u32 len;
|
||||
u8* ptr;
|
||||
u32 ofs; //offset within the memspan
|
||||
} items[MAXSIZE];
|
||||
|
||||
int size;
|
||||
|
||||
//this MemSpan shall be considered the first argument to a standard memcmp
|
||||
//the length shall be as specified in this MemSpan, unless you specify otherwise
|
||||
int memcmp(void* buf2, int size=-1)
|
||||
{
|
||||
if(size==-1) size = this->size;
|
||||
size = std::min(this->size,size);
|
||||
for(int i=0;i<numItems;i++)
|
||||
{
|
||||
Item &item = items[i];
|
||||
int todo = std::min((int)item.len,size);
|
||||
size -= todo;
|
||||
int temp = ::memcmp(item.ptr,((u8*)buf2)+item.ofs,todo);
|
||||
if(temp) return temp;
|
||||
if(size == 0) break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//dumps the memspan to the specified buffer
|
||||
//you may set size to limit the size to be copied
|
||||
int dump(void* buf, int size=-1)
|
||||
{
|
||||
if(size==-1) size = this->size;
|
||||
size = std::min(this->size,size);
|
||||
u8* bufptr = (u8*)buf;
|
||||
int done = 0;
|
||||
for(int i=0;i<numItems;i++)
|
||||
{
|
||||
Item item = items[i];
|
||||
int todo = std::min((int)item.len,size);
|
||||
size -= todo;
|
||||
done += todo;
|
||||
memcpy(bufptr,item.ptr,todo);
|
||||
bufptr += todo;
|
||||
if(size==0) return done;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
};
|
||||
|
||||
//creates a MemSpan in texture memory
|
||||
static MemSpan MemSpan_TexMem(u32 ofs, u32 len)
|
||||
{
|
||||
MemSpan ret;
|
||||
ret.size = len;
|
||||
u32 currofs = 0;
|
||||
while(len) {
|
||||
MemSpan::Item &curr = ret.items[ret.numItems++];
|
||||
curr.start = ofs&0x1FFFF;
|
||||
u32 slot = (ofs>>17)&3; //slots will wrap around
|
||||
curr.len = std::min(len,0x20000-curr.start);
|
||||
curr.ofs = currofs;
|
||||
len -= curr.len;
|
||||
ofs += curr.len;
|
||||
currofs += curr.len;
|
||||
u8* ptr = ARM9Mem.textureSlotAddr[slot];
|
||||
|
||||
if(ptr == ARM9Mem.blank_memory) {
|
||||
PROGINFO("Tried to reference unmapped texture memory: slot %d\n",slot);
|
||||
}
|
||||
curr.ptr = ptr + curr.start;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//creates a MemSpan in texture palette memory
|
||||
static MemSpan MemSpan_TexPalette(u32 ofs, u32 len)
|
||||
{
|
||||
MemSpan ret;
|
||||
ret.size = len;
|
||||
u32 currofs = 0;
|
||||
while(len) {
|
||||
MemSpan::Item &curr = ret.items[ret.numItems++];
|
||||
curr.start = ofs&0x3FFF;
|
||||
u32 slot = (ofs>>14)&7; //this masks to 8 slots, but there are really only 6
|
||||
if(slot>5) {
|
||||
PROGINFO("Texture palette overruns texture memory. Wrapping at palette slot 0.\n");
|
||||
slot -= 5;
|
||||
}
|
||||
curr.len = std::min(len,0x4000-curr.start);
|
||||
curr.ofs = currofs;
|
||||
len -= curr.len;
|
||||
ofs += curr.len;
|
||||
//if(len != 0)
|
||||
//here is an actual test case of bank spanning
|
||||
currofs += curr.len;
|
||||
u8* ptr = ARM9Mem.texPalSlot[slot];
|
||||
|
||||
if(ptr == ARM9Mem.blank_memory) {
|
||||
PROGINFO("Tried to reference unmapped texture palette memory: 16k slot #%d\n",slot);
|
||||
}
|
||||
curr.ptr = ptr + curr.start;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifndef CTASSERT
|
||||
|
@ -82,12 +199,14 @@ static const unsigned short map3d_cull[4] = {GL_FRONT_AND_BACK, GL_FRONT, GL_BAC
|
|||
static const int texEnv[4] = { GL_MODULATE, GL_DECAL, GL_MODULATE, GL_MODULATE };
|
||||
static const int depthFunc[2] = { GL_LESS, GL_EQUAL };
|
||||
static bool needRefreshFramebuffer = false;
|
||||
|
||||
static unsigned char texMAP[1024*2048*4];
|
||||
static unsigned int textureMode=TEXMODE_NONE;
|
||||
|
||||
float clearAlpha;
|
||||
|
||||
|
||||
|
||||
//raw ds format poly attributes, installed from the display list
|
||||
static u32 textureFormat=0, texturePalette=0;
|
||||
|
||||
//derived values extracted from polyattr etc
|
||||
static bool wireframe=false, alpha31=false;
|
||||
|
@ -100,8 +219,6 @@ static bool alphaDepthWrite;
|
|||
static unsigned int lightMask=0;
|
||||
static bool isTranslucent;
|
||||
|
||||
static u32 textureFormat=0, texturePalette=0;
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
#define OGLEXT(x,y) x y = 0;
|
||||
|
@ -134,7 +251,6 @@ OGLEXT(PFNGLVALIDATEPROGRAMPROC,glValidateProgram)
|
|||
OGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC,glBlendFuncSeparateEXT)
|
||||
OGLEXT(PFNGLGETUNIFORMLOCATIONPROC,glGetUniformLocation)
|
||||
OGLEXT(PFNGLUNIFORM1IPROC,glUniform1i)
|
||||
OGLEXT(PFNGLUNIFORM1IVPROC,glUniform1iv)
|
||||
#endif
|
||||
|
||||
#if !defined(GL_VERSION_1_3) || defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
|
@ -219,6 +335,37 @@ static void _xglDisable(GLenum cap) {
|
|||
_xglDisable(cap); }
|
||||
|
||||
|
||||
//================================================= Textures
|
||||
#define MAX_TEXTURE 500
|
||||
#ifdef SSE2
|
||||
struct ALIGN(16) TextureCache
|
||||
#else
|
||||
struct ALIGN(8) TextureCache
|
||||
#endif
|
||||
{
|
||||
GLenum id;
|
||||
u32 frm;
|
||||
u32 mode;
|
||||
u32 pal;
|
||||
u32 sizeX;
|
||||
u32 sizeY;
|
||||
float invSizeX;
|
||||
float invSizeY;
|
||||
int textureSize, indexSize;
|
||||
u8 texture[128*1024]; // 128Kb texture slot
|
||||
u8 palette[256*2];
|
||||
|
||||
//set if this texture is suspected be invalid due to a vram reconfigure
|
||||
bool suspectedInvalid;
|
||||
|
||||
};
|
||||
|
||||
TextureCache texcache[MAX_TEXTURE+1];
|
||||
u32 texcache_count;
|
||||
|
||||
u32 texcache_start;
|
||||
u32 texcache_stop;
|
||||
//u32 texcache_last;
|
||||
|
||||
GLenum oglTempTextureID[MAX_TEXTURE];
|
||||
GLenum oglToonTableTextureID;
|
||||
|
@ -271,7 +418,6 @@ GLuint shaderProgram;
|
|||
|
||||
static GLuint hasTexLoc;
|
||||
static GLuint texBlendLoc;
|
||||
static bool hasTexture = false;
|
||||
|
||||
/* Shaders init */
|
||||
|
||||
|
@ -330,42 +476,27 @@ static void createShaders()
|
|||
|
||||
static void OGLReset()
|
||||
{
|
||||
TexCache_Reset();
|
||||
|
||||
for (int i = 0; i < MAX_TEXTURE; i++)
|
||||
texcache[i].id=oglTempTextureID[i];
|
||||
int i;
|
||||
|
||||
//reset the texture cache
|
||||
memset(&texcache,0,sizeof(texcache));
|
||||
texcache_count=0;
|
||||
for (i = 0; i < MAX_TEXTURE; i++)
|
||||
texcache[i].id=oglTempTextureID[i];
|
||||
texcache_start=0;
|
||||
texcache_stop=MAX_TEXTURE<<1;
|
||||
|
||||
for(i=0;i<MAX_TEXTURE+1;i++)
|
||||
texcache[i].suspectedInvalid = true;
|
||||
|
||||
//clear the framebuffers
|
||||
// memset(GPU_screenStencil,0,sizeof(GPU_screenStencil));
|
||||
memset(GPU_screen3D,0,sizeof(GPU_screen3D));
|
||||
needRefreshFramebuffer = false;
|
||||
memset(texMAP, 0, sizeof(texMAP));
|
||||
textureMode=TEXMODE_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void BindTexture(u32 tx)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D,(GLuint)texcache[tx].id);
|
||||
glMatrixMode (GL_TEXTURE);
|
||||
glLoadIdentity ();
|
||||
glScaled (texcache[tx].invSizeX, texcache[tx].invSizeY, 1.0f);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (BIT16(texcache[tx].frm) ? (BIT18(texcache[tx].frm)?GL_MIRRORED_REPEAT:GL_REPEAT) : GL_CLAMP));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (BIT17(texcache[tx].frm) ? (BIT19(texcache[tx].frm)?GL_MIRRORED_REPEAT:GL_REPEAT) : GL_CLAMP));
|
||||
}
|
||||
|
||||
static void BindTextureData(u32 tx, u8* data)
|
||||
{
|
||||
BindTexture(tx);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
texcache[tx].sizeX, texcache[tx].sizeY, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
||||
|
||||
static char OGLInit(void)
|
||||
{
|
||||
GLuint loc;
|
||||
|
@ -378,9 +509,6 @@ static char OGLInit(void)
|
|||
if(!BEGINGL())
|
||||
return 0;
|
||||
|
||||
TexCache_BindTexture = BindTexture;
|
||||
TexCache_BindTextureData = BindTextureData;
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT,8);
|
||||
|
||||
xglEnable (GL_NORMALIZE);
|
||||
|
@ -422,7 +550,6 @@ static char OGLInit(void)
|
|||
#endif
|
||||
INITOGLEXT(PFNGLGETUNIFORMLOCATIONPROC,glGetUniformLocation)
|
||||
INITOGLEXT(PFNGLUNIFORM1IPROC,glUniform1i)
|
||||
INITOGLEXT(PFNGLUNIFORM1IVPROC,glUniform1iv)
|
||||
#endif
|
||||
#if !defined(GL_VERSION_1_3) || defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
INITOGLEXT(PFNGLACTIVETEXTUREPROC,glActiveTexture)
|
||||
|
@ -452,7 +579,6 @@ static char OGLInit(void)
|
|||
if(glBlendFuncSeparateEXT != NULL)
|
||||
{
|
||||
glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_DST_ALPHA);
|
||||
// glBlendFuncSeparateEXT(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if(hasShaders)
|
||||
|
@ -502,20 +628,60 @@ static void OGLClose()
|
|||
ENDGL();
|
||||
}
|
||||
|
||||
//todo - make all color conversions go through a properly spread table!!
|
||||
|
||||
#if defined (DEBUG_DUMP_TEXTURE) && defined (WIN32)
|
||||
static void DebugDumpTexture(int which)
|
||||
{
|
||||
char fname[100];
|
||||
sprintf(fname,"c:\\dump\\%d.bmp", which);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D,texcache[which].id);
|
||||
glGetTexImage( GL_TEXTURE_2D ,
|
||||
0,
|
||||
GL_BGRA_EXT,
|
||||
GL_UNSIGNED_BYTE,
|
||||
texMAP);
|
||||
|
||||
NDS_WriteBMP_32bppBuffer(texcache[which].sizeX,texcache[which].sizeY,texMAP,fname);
|
||||
}
|
||||
#else
|
||||
#define DebugDumpTexture(which) do { (void)which; } while (0)
|
||||
#endif
|
||||
|
||||
//================================================================================
|
||||
static int lastTexture = -1;
|
||||
static bool hasTexture = false;
|
||||
static void setTexture(unsigned int format, unsigned int texpal)
|
||||
{
|
||||
textureFormat = format;
|
||||
texturePalette = texpal;
|
||||
//for each texformat, number of palette entries
|
||||
const int palSizes[] = {0, 32, 4, 16, 256, 0, 8, 0};
|
||||
|
||||
//for each texformat, multiplier from numtexels to numbytes (fixed point 30.2)
|
||||
const int texSizes[] = {0, 4, 1, 2, 4, 1, 4, 8};
|
||||
|
||||
//used to hold a copy of the palette specified for this texture
|
||||
u16 pal[256];
|
||||
|
||||
u32 *dwdst = (u32*)texMAP;
|
||||
|
||||
textureMode = (unsigned short)((format>>26)&0x07);
|
||||
unsigned int sizeX=(8 << ((format>>20)&0x07));
|
||||
unsigned int sizeY=(8 << ((format>>23)&0x07));
|
||||
unsigned int imageSize = sizeX*sizeY;
|
||||
|
||||
u8 *adr;
|
||||
|
||||
u32 textureMode = (unsigned short)((format>>26)&0x07);
|
||||
|
||||
if (format==0)
|
||||
{
|
||||
texcache_count=-1;
|
||||
if(hasShaders && hasTexture) { glUniform1i(hasTexLoc, 0); hasTexture = false; }
|
||||
return;
|
||||
}
|
||||
if (textureMode==0)
|
||||
{
|
||||
texcache_count=-1;
|
||||
if(hasShaders && hasTexture) { glUniform1i(hasTexLoc, 0); hasTexture = false; }
|
||||
return;
|
||||
}
|
||||
|
@ -526,8 +692,400 @@ static void setTexture(unsigned int format, unsigned int texpal)
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
u32 paletteAddress;
|
||||
|
||||
TexCache_SetTexture(format, texpal);
|
||||
switch (textureMode)
|
||||
{
|
||||
case TEXMODE_I2:
|
||||
paletteAddress = texturePalette<<3;
|
||||
break;
|
||||
case TEXMODE_A3I5: //a3i5
|
||||
case TEXMODE_I4: //i4
|
||||
case TEXMODE_I8: //i8
|
||||
case TEXMODE_A5I3: //a5i3
|
||||
case TEXMODE_16BPP: //16bpp
|
||||
case TEXMODE_4X4: //4x4
|
||||
default:
|
||||
paletteAddress = texturePalette<<4;
|
||||
break;
|
||||
}
|
||||
|
||||
//analyze the texture memory mapping and the specifications of this texture
|
||||
int palSize = palSizes[textureMode];
|
||||
int texSize = (imageSize*texSizes[textureMode])>>2; //shifted because the texSizes multiplier is fixed point
|
||||
MemSpan ms = MemSpan_TexMem((format&0xFFFF)<<3,texSize);
|
||||
MemSpan mspal = MemSpan_TexPalette(paletteAddress,palSize*2);
|
||||
|
||||
//determine the location for 4x4 index data
|
||||
u32 indexBase;
|
||||
if((format & 0xc000) == 0x8000) indexBase = 0x30000;
|
||||
else indexBase = 0x20000;
|
||||
|
||||
u32 indexOffset = (format&0x3FFF)<<2;
|
||||
|
||||
int indexSize = 0;
|
||||
MemSpan msIndex;
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
indexSize = imageSize>>3;
|
||||
msIndex = MemSpan_TexMem(indexOffset+indexBase,indexSize);
|
||||
}
|
||||
|
||||
|
||||
//dump the palette to a temp buffer, so that we don't have to worry about memory mapping.
|
||||
//this isnt such a problem with texture memory, because we read sequentially from it.
|
||||
//however, we read randomly from palette memory, so the mapping is more costly.
|
||||
mspal.dump(pal);
|
||||
|
||||
|
||||
u32 tx=texcache_start;
|
||||
|
||||
//if(false)
|
||||
while (TRUE)
|
||||
{
|
||||
//conditions where we give up and regenerate the texture:
|
||||
if (texcache_stop == tx) break;
|
||||
if (texcache[tx].frm == 0) break;
|
||||
|
||||
//conditions where we reject matches:
|
||||
//when the teximage or texpal params dont match
|
||||
//(this is our key for identifying palettes in the cache)
|
||||
if (texcache[tx].frm != format) goto REJECT;
|
||||
if (texcache[tx].pal != texpal) goto REJECT;
|
||||
|
||||
//the texture matches params, but isnt suspected invalid. accept it.
|
||||
if (!texcache[tx].suspectedInvalid) goto ACCEPT;
|
||||
|
||||
//if we couldnt cache this entire texture due to it being too large, then reject it
|
||||
if (texSize+indexSize > (int)sizeof(texcache[tx].texture)) goto REJECT;
|
||||
|
||||
//when the palettes dont match:
|
||||
//note that we are considering 4x4 textures to have a palette size of 0.
|
||||
//they really have a potentially HUGE palette, too big for us to handle like a normal palette,
|
||||
//so they go through a different system
|
||||
if (mspal.size != 0 && memcmp(texcache[tx].palette,pal,mspal.size)) goto REJECT;
|
||||
|
||||
//when the texture data doesn't match
|
||||
if(ms.memcmp(texcache[tx].texture,sizeof(texcache[tx].texture))) goto REJECT;
|
||||
|
||||
//if the texture is 4x4 then the index data must match
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
if(msIndex.memcmp(texcache[tx].texture + texcache[tx].textureSize,texcache[tx].indexSize)) goto REJECT;
|
||||
}
|
||||
|
||||
|
||||
ACCEPT:
|
||||
texcache[tx].suspectedInvalid = false;
|
||||
texcache_count = tx;
|
||||
if(lastTexture == -1 || (int)tx != lastTexture)
|
||||
{
|
||||
lastTexture = tx;
|
||||
glBindTexture(GL_TEXTURE_2D,texcache[tx].id);
|
||||
glMatrixMode (GL_TEXTURE);
|
||||
glLoadIdentity ();
|
||||
glScaled (texcache[tx].invSizeX, texcache[tx].invSizeY, 1.0f);
|
||||
}
|
||||
return;
|
||||
|
||||
REJECT:
|
||||
tx++;
|
||||
if ( tx > MAX_TEXTURE )
|
||||
{
|
||||
texcache_stop=texcache_start;
|
||||
texcache[texcache_stop].frm=0;
|
||||
texcache_start++;
|
||||
if (texcache_start>MAX_TEXTURE)
|
||||
{
|
||||
texcache_start=0;
|
||||
texcache_stop=MAX_TEXTURE<<1;
|
||||
}
|
||||
tx=0;
|
||||
}
|
||||
}
|
||||
|
||||
lastTexture = tx;
|
||||
glBindTexture(GL_TEXTURE_2D, texcache[tx].id);
|
||||
|
||||
texcache[tx].suspectedInvalid = false;
|
||||
texcache[tx].frm=format;
|
||||
texcache[tx].mode=textureMode;
|
||||
texcache[tx].pal=texpal;
|
||||
texcache[tx].sizeX=sizeX;
|
||||
texcache[tx].sizeY=sizeY;
|
||||
texcache[tx].invSizeX=1.0f/((float)(sizeX));
|
||||
texcache[tx].invSizeY=1.0f/((float)(sizeY));
|
||||
texcache[tx].textureSize = ms.dump(texcache[tx].texture,sizeof(texcache[tx].texture));
|
||||
|
||||
//dump palette data for cache keying
|
||||
if ( palSize )
|
||||
{
|
||||
memcpy(texcache[tx].palette, pal, palSize*2);
|
||||
}
|
||||
//dump 4x4 index data for cache keying
|
||||
texcache[tx].indexSize = 0;
|
||||
if(textureMode == TEXMODE_4X4)
|
||||
{
|
||||
texcache[tx].indexSize = std::min(msIndex.size,(int)sizeof(texcache[tx].texture) - texcache[tx].textureSize);
|
||||
msIndex.dump(texcache[tx].texture+texcache[tx].textureSize,texcache[tx].indexSize);
|
||||
}
|
||||
|
||||
|
||||
glMatrixMode (GL_TEXTURE);
|
||||
glLoadIdentity ();
|
||||
glScaled (texcache[tx].invSizeX, texcache[tx].invSizeY, 1.0f);
|
||||
|
||||
|
||||
//INFO("Texture %03i - format=%08X; pal=%04X (mode %X, width %04i, height %04i)\n",i, texcache[i].frm, texcache[i].pal, texcache[i].mode, sizeX, sizeY);
|
||||
|
||||
//============================================================================ Texture conversion
|
||||
u32 palZeroTransparent = (1-((format>>29)&1))*255; // shash: CONVERT THIS TO A TABLE :)
|
||||
|
||||
switch (texcache[tx].mode)
|
||||
{
|
||||
case TEXMODE_A3I5:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u16 c = pal[*adr&31];
|
||||
u8 alpha = *adr>>5;
|
||||
*dwdst++ = RGB15TO32(c,material_3bit_to_8bit[alpha]);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I2:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u8 bits;
|
||||
u16 c;
|
||||
|
||||
bits = (*adr)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>2)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>4)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>6)&0x3;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I4:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; x++)
|
||||
{
|
||||
u8 bits;
|
||||
u16 c;
|
||||
|
||||
bits = (*adr)&0xF;
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
bits = ((*adr)>>4);
|
||||
c = pal[bits];
|
||||
*dwdst++ = RGB15TO32(c,(bits == 0) ? palZeroTransparent : 255);
|
||||
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_I8:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = pal[*adr];
|
||||
*dwdst++ = RGB15TO32(c,(*adr == 0) ? palZeroTransparent : 255);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TEXMODE_4X4:
|
||||
{
|
||||
//RGB16TO32 is used here because the other conversion macros result in broken interpolation logic
|
||||
|
||||
if(ms.numItems != 1) {
|
||||
PROGINFO("Your 4x4 texture has overrun its texture slot.\n");
|
||||
}
|
||||
//this check isnt necessary since the addressing is tied to the texture data which will also run out:
|
||||
//if(msIndex.numItems != 1) PROGINFO("Your 4x4 texture index has overrun its slot.\n");
|
||||
|
||||
#define PAL4X4(offset) ( *(u16*)( ARM9Mem.texPalSlot[((paletteAddress + (offset)*2)>>14)] + ((paletteAddress + (offset)*2)&0x3FFF) ) )
|
||||
|
||||
u16* slot1;
|
||||
u32* map = (u32*)ms.items[0].ptr;
|
||||
u32 limit = ms.items[0].len<<2;
|
||||
u32 d = 0;
|
||||
if ( (texcache[tx].frm & 0xc000) == 0x8000)
|
||||
// texel are in slot 2
|
||||
slot1=(u16*)&ARM9Mem.textureSlotAddr[1][((texcache[tx].frm & 0x3FFF)<<2)+0x010000];
|
||||
else
|
||||
slot1=(u16*)&ARM9Mem.textureSlotAddr[1][(texcache[tx].frm & 0x3FFF)<<2];
|
||||
|
||||
u16 yTmpSize = (texcache[tx].sizeY>>2);
|
||||
u16 xTmpSize = (texcache[tx].sizeX>>2);
|
||||
|
||||
//this is flagged whenever a 4x4 overruns its slot.
|
||||
//i am guessing we just generate black in that case
|
||||
bool dead = false;
|
||||
|
||||
for (int y = 0; y < yTmpSize; y ++)
|
||||
{
|
||||
u32 tmpPos[4]={(y<<2)*texcache[tx].sizeX,((y<<2)+1)*texcache[tx].sizeX,
|
||||
((y<<2)+2)*texcache[tx].sizeX,((y<<2)+3)*texcache[tx].sizeX};
|
||||
for (int x = 0; x < xTmpSize; x ++, d++)
|
||||
{
|
||||
if(d >= limit)
|
||||
dead = true;
|
||||
|
||||
if(dead) {
|
||||
for (int sy = 0; sy < 4; sy++)
|
||||
{
|
||||
u32 currentPos = (x<<2) + tmpPos[sy];
|
||||
dwdst[currentPos] = dwdst[currentPos+1] = dwdst[currentPos+2] = dwdst[currentPos+3] = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 currBlock = map[d];
|
||||
u16 pal1 = slot1[d];
|
||||
u16 pal1offset = (pal1 & 0x3FFF)<<1;
|
||||
u8 mode = pal1>>14;
|
||||
u32 tmp_col[4];
|
||||
|
||||
tmp_col[0]=RGB16TO32(PAL4X4(pal1offset),255);
|
||||
tmp_col[1]=RGB16TO32(PAL4X4(pal1offset+1),255);
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
tmp_col[2]=RGB16TO32(PAL4X4(pal1offset+2),255);
|
||||
tmp_col[3]=RGB16TO32(0x7FFF,0);
|
||||
break;
|
||||
case 1:
|
||||
tmp_col[2]=(((tmp_col[0]&0xFF)+(tmp_col[1]&0xff))>>1)|
|
||||
(((tmp_col[0]&(0xFF<<8))+(tmp_col[1]&(0xFF<<8)))>>1)|
|
||||
(((tmp_col[0]&(0xFF<<16))+(tmp_col[1]&(0xFF<<16)))>>1)|
|
||||
(0xff<<24);
|
||||
tmp_col[3]=RGB16TO32(0x7FFF,0);
|
||||
break;
|
||||
case 2:
|
||||
tmp_col[2]=RGB16TO32(PAL4X4(pal1offset+2),255);
|
||||
tmp_col[3]=RGB16TO32(PAL4X4(pal1offset+3),255);
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
u32 red1, red2;
|
||||
u32 green1, green2;
|
||||
u32 blue1, blue2;
|
||||
u16 tmp1, tmp2;
|
||||
|
||||
red1=tmp_col[0]&0xff;
|
||||
green1=(tmp_col[0]>>8)&0xff;
|
||||
blue1=(tmp_col[0]>>16)&0xff;
|
||||
red2=tmp_col[1]&0xff;
|
||||
green2=(tmp_col[1]>>8)&0xff;
|
||||
blue2=(tmp_col[1]>>16)&0xff;
|
||||
|
||||
tmp1=((red1*5+red2*3)>>6)|
|
||||
(((green1*5+green2*3)>>6)<<5)|
|
||||
(((blue1*5+blue2*3)>>6)<<10);
|
||||
tmp2=((red2*5+red1*3)>>6)|
|
||||
(((green2*5+green1*3)>>6)<<5)|
|
||||
(((blue2*5+blue1*3)>>6)<<10);
|
||||
|
||||
tmp_col[2]=RGB16TO32(tmp1,255);
|
||||
tmp_col[3]=RGB16TO32(tmp2,255);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//set all 16 texels
|
||||
for (int sy = 0; sy < 4; sy++)
|
||||
{
|
||||
// Texture offset
|
||||
u32 currentPos = (x<<2) + tmpPos[sy];
|
||||
u8 currRow = (u8)((currBlock>>(sy<<3))&0xFF);
|
||||
|
||||
dwdst[currentPos] = tmp_col[currRow&3];
|
||||
dwdst[currentPos+1] = tmp_col[(currRow>>2)&3];
|
||||
dwdst[currentPos+2] = tmp_col[(currRow>>4)&3];
|
||||
dwdst[currentPos+3] = tmp_col[(currRow>>6)&3];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case TEXMODE_A5I3:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
adr = ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = pal[*adr&0x07];
|
||||
u8 alpha = (*adr>>3);
|
||||
*dwdst++ = RGB15TO32(c,material_5bit_to_8bit[alpha]);
|
||||
adr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TEXMODE_16BPP:
|
||||
{
|
||||
for(int j=0;j<ms.numItems;j++) {
|
||||
u16* map = (u16*)ms.items[j].ptr;
|
||||
for(u32 x = 0; x < ms.items[j].len; ++x)
|
||||
{
|
||||
u16 c = map[x];
|
||||
int alpha = ((c&0x8000)?255:0);
|
||||
*dwdst++ = RGB15TO32(c&0x7FFF,alpha);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
texcache[tx].sizeX, texcache[tx].sizeY, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, texMAP);
|
||||
|
||||
DebugDumpTexture(tx);
|
||||
|
||||
//============================================================================================
|
||||
|
||||
texcache_count=tx;
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (BIT16(texcache[tx].frm) ? (BIT18(texcache[tx].frm)?GL_MIRRORED_REPEAT:GL_REPEAT) : GL_CLAMP));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (BIT17(texcache[tx].frm) ? (BIT19(texcache[tx].frm)?GL_MIRRORED_REPEAT:GL_REPEAT) : GL_CLAMP));
|
||||
}
|
||||
|
||||
|
||||
|
@ -538,8 +1096,6 @@ static void setTexture(unsigned int format, unsigned int texpal)
|
|||
//glColorMask
|
||||
static u32 stencilStateSet = -1;
|
||||
|
||||
static u32 polyalpha=0;
|
||||
|
||||
static void BeginRenderPoly()
|
||||
{
|
||||
bool enableDepthWrite = true;
|
||||
|
@ -580,7 +1136,7 @@ static void BeginRenderPoly()
|
|||
//when the polyID is zero, we are writing the shadow mask.
|
||||
//set stencilbuf = 1 where the shadow volume is obstructed by geometry.
|
||||
//do not write color or depth information.
|
||||
glStencilFunc(GL_ALWAYS,65,255);
|
||||
glStencilFunc(GL_ALWAYS,2,255);
|
||||
glStencilOp(GL_KEEP,GL_REPLACE,GL_KEEP);
|
||||
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
|
||||
}
|
||||
|
@ -591,24 +1147,16 @@ static void BeginRenderPoly()
|
|||
//when the polyid is nonzero, we are drawing the shadow poly.
|
||||
//only draw the shadow poly where the stencilbuf==1.
|
||||
//I am not sure whether to update the depth buffer here--so I chose not to.
|
||||
glStencilFunc(GL_EQUAL,65,255);
|
||||
glStencilFunc(GL_EQUAL,2,255);
|
||||
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
xglEnable(GL_STENCIL_TEST);
|
||||
if(isTranslucent)
|
||||
{
|
||||
stencilStateSet = 3;
|
||||
glStencilFunc(GL_NOTEQUAL,polyID,255);
|
||||
glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
}
|
||||
else
|
||||
if(stencilStateSet!=2) {
|
||||
stencilStateSet=2;
|
||||
glStencilFunc(GL_ALWAYS,64,255);
|
||||
stencilStateSet=2;
|
||||
glStencilFunc(GL_ALWAYS,1,255);
|
||||
glStencilOp(GL_REPLACE,GL_REPLACE,GL_REPLACE);
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
}
|
||||
|
@ -652,10 +1200,8 @@ static void InstallPolygonAttrib(unsigned long val)
|
|||
// Alpha value, actually not well handled, 0 should be wireframe
|
||||
wireframe = ((val>>16)&0x1F)==0;
|
||||
|
||||
polyalpha = ((val>>16)&0x1F);
|
||||
|
||||
// polyID
|
||||
polyID = (val>>24)&0x3F;
|
||||
polyID = (val>>24)&0x1F;
|
||||
}
|
||||
|
||||
static void Control()
|
||||
|
@ -664,7 +1210,7 @@ static void Control()
|
|||
else glDisable (GL_TEXTURE_2D);
|
||||
|
||||
if(gfx3d.enableAlphaTest)
|
||||
glAlphaFunc (GL_GREATER, gfx3d.alphaTestRef/31.f);
|
||||
glAlphaFunc (GL_GREATER, gfx3d.alphaTestRef);
|
||||
else
|
||||
glAlphaFunc (GL_GREATER, 0);
|
||||
|
||||
|
@ -695,15 +1241,12 @@ static void OGLRender()
|
|||
|
||||
glViewport(gfx3d.viewport.x,gfx3d.viewport.y,gfx3d.viewport.width,gfx3d.viewport.height);
|
||||
|
||||
float clearColor[4] = {
|
||||
((float)(gfx3d.clearColor&0x1F))/31.0f,
|
||||
((float)((gfx3d.clearColor>>5)&0x1F))/31.0f,
|
||||
((float)((gfx3d.clearColor>>10)&0x1F))/31.0f,
|
||||
((float)((gfx3d.clearColor>>16)&0x1F))/31.0f,
|
||||
};
|
||||
glClearColor(clearColor[0],clearColor[1],clearColor[2],clearColor[3]);
|
||||
//it might be handy to print the size of the projection list, in case a game is doing something weird with it
|
||||
//printf("%d\n",gfx3d.projlist->count);
|
||||
|
||||
//we're not using the alpha clear color right now
|
||||
glClearColor(gfx3d.clearColor[0],gfx3d.clearColor[1],gfx3d.clearColor[2], gfx3d.clearColor[3]);
|
||||
glClearDepth(gfx3d.clearDepth);
|
||||
glClearStencil((gfx3d.clearColor >> 24) & 0x3F);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -729,7 +1272,6 @@ static void OGLRender()
|
|||
InstallPolygonAttrib(lastPolyAttr=poly->polyAttr);
|
||||
lastTextureFormat = textureFormat = poly->texParam;
|
||||
lastTexturePalette = texturePalette = poly->texPalette;
|
||||
lastPolyAttr = poly->polyAttr;
|
||||
BeginRenderPoly();
|
||||
}
|
||||
|
||||
|
@ -740,7 +1282,7 @@ static void OGLRender()
|
|||
lastProjIndex = poly->projIndex;
|
||||
}*/
|
||||
|
||||
/* glBegin(type==3?GL_TRIANGLES:GL_QUADS);
|
||||
glBegin(type==3?GL_TRIANGLES:GL_QUADS);
|
||||
for(int j=0;j<type;j++) {
|
||||
VERT* vert = &gfx3d.vertlist->list[poly->vertIndexes[j]];
|
||||
u8 color[4] = {
|
||||
|
@ -765,47 +1307,6 @@ static void OGLRender()
|
|||
//glVertex4fv(tempCoord);
|
||||
glVertex4fv(vert->coord);
|
||||
}
|
||||
glEnd();*/
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
for(int j = 1; j < (type-1); j++)
|
||||
{
|
||||
VERT *vert0 = &gfx3d.vertlist->list[poly->vertIndexes[0]];
|
||||
VERT *vert1 = &gfx3d.vertlist->list[poly->vertIndexes[j]];
|
||||
VERT *vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j+1]];
|
||||
|
||||
u8 color0[4] = {
|
||||
material_5bit_to_8bit[vert0->color[0]],
|
||||
material_5bit_to_8bit[vert0->color[1]],
|
||||
material_5bit_to_8bit[vert0->color[2]],
|
||||
material_5bit_to_8bit[vert0->color[3]]
|
||||
};
|
||||
u8 color1[4] = {
|
||||
material_5bit_to_8bit[vert1->color[0]],
|
||||
material_5bit_to_8bit[vert1->color[1]],
|
||||
material_5bit_to_8bit[vert1->color[2]],
|
||||
material_5bit_to_8bit[vert1->color[3]]
|
||||
};
|
||||
u8 color2[4] = {
|
||||
material_5bit_to_8bit[vert2->color[0]],
|
||||
material_5bit_to_8bit[vert2->color[1]],
|
||||
material_5bit_to_8bit[vert2->color[2]],
|
||||
material_5bit_to_8bit[vert2->color[3]]
|
||||
};
|
||||
|
||||
glTexCoord2fv(vert0->texcoord);
|
||||
glColor4ubv((GLubyte*)color0);
|
||||
glVertex4fv(vert0->coord);
|
||||
|
||||
glTexCoord2fv(vert1->texcoord);
|
||||
glColor4ubv((GLubyte*)color1);
|
||||
glVertex4fv(vert1->coord);
|
||||
|
||||
glTexCoord2fv(vert2->texcoord);
|
||||
glColor4ubv((GLubyte*)color2);
|
||||
glVertex4fv(vert2->coord);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
@ -818,7 +1319,20 @@ static void OGLRender()
|
|||
|
||||
static void OGLVramReconfigureSignal()
|
||||
{
|
||||
TexCache_Invalidate();
|
||||
//well, this is a very blunt instrument.
|
||||
//lets just flag all the textures as invalid.
|
||||
for(int i=0;i<MAX_TEXTURE+1;i++) {
|
||||
texcache[i].suspectedInvalid = true;
|
||||
|
||||
//invalidate all 4x4 textures when texture palettes change mappings
|
||||
//this is necessary because we arent tracking 4x4 texture palettes to look for changes.
|
||||
//Although I concede this is a bit paranoid.. I think the odds of anyone changing 4x4 palette data
|
||||
//without also changing the texture data is pretty much zero.
|
||||
//
|
||||
//TODO - move this to a separate signal: split into TexReconfigureSignal and TexPaletteReconfigureSignal
|
||||
if(texcache[i].mode == TEXMODE_4X4)
|
||||
texcache[i].frm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void GL_ReadFramebuffer()
|
|
@ -307,6 +307,44 @@ u32 SPU_ReadLong(u32 addr)
|
|||
{
|
||||
addr &= 0xFFF;
|
||||
|
||||
if (addr < 0x500)
|
||||
{
|
||||
switch (addr & 0xF)
|
||||
{
|
||||
case 0x0:
|
||||
// LOG("Sound Channel %d Control Register long read\n", (addr >> 4) & 0xF);
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
case 0x4:
|
||||
// LOG("Sound Channel %d Data Source Register long read\n");
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
case 0x8:
|
||||
// LOG("Sound Channel %d Timer/Loop Start Register long read\n", (addr >> 4) & 0xF);
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
case 0xC:
|
||||
// LOG("Sound Channel %d Length Register long read\n", (addr >> 4) & 0xF);
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
default:
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (addr & 0x1F)
|
||||
{
|
||||
case 0x000:
|
||||
// LOG("Sound Control Register long read\n");
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
case 0x004:
|
||||
// LOG("Sound Bias Register long read\n");
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
case 0x008:
|
||||
// LOG("Sound Capture 0/1 Control Register long read: %08X\n");
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
default:
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
}
|
||||
}
|
||||
|
||||
return T1ReadLong(MMU.ARM7_REG, addr);
|
||||
}
|
||||
|
||||
|
@ -350,6 +388,69 @@ void SPU_WriteByte(u32 addr, u8 val)
|
|||
{
|
||||
SPU_core->WriteByte(addr,val);
|
||||
if(SPU_user) SPU_user->WriteByte(addr,val);
|
||||
|
||||
switch (addr & 0xF)
|
||||
{
|
||||
case 0x0:
|
||||
//LOG("Sound Channel %d Volume write: %02X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x1:
|
||||
//LOG("Sound Channel %d Data Shift/Hold write: %02X\n",(addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x2:
|
||||
//LOG("Sound Channel %d Panning write: %02X\n",(addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x3:
|
||||
break;
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
//LOG("Sound Channel %d Data Source Register write: %08X %02X\n",(addr >> 4) & 0xF, addr, val);
|
||||
break;
|
||||
case 0x8:
|
||||
//LOG("Sound Channel Timer(Low byte) write: %08X - %02X\n", addr, val);
|
||||
break;
|
||||
case 0x9:
|
||||
//LOG("Sound Channel Timer(High byte) write: %08X - %02X\n", addr, val);
|
||||
break;
|
||||
case 0xA:
|
||||
//LOG("Sound Channel Loop Start(Low byte) write: %08X - %02X\n", addr, val);
|
||||
break;
|
||||
case 0xB:
|
||||
//LOG("Sound Channel Loop Start(High byte) write: %08X - %02X\n", addr, val);
|
||||
break;
|
||||
case 0xC:
|
||||
case 0xD:
|
||||
case 0xE:
|
||||
case 0xF:
|
||||
//LOG("Sound Channel %d Length Register write: %08X %02X\n",(addr >> 4) & 0xF, addr, val);
|
||||
break;
|
||||
default:
|
||||
LOG("Unsupported Sound Register byte write: %08X %02X\n", addr, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (addr & 0x1F)
|
||||
{
|
||||
case 0x000:
|
||||
case 0x001:
|
||||
//LOG("Sound Control Register write: %08X %02X\n", addr, val);
|
||||
break;
|
||||
case 0x004:
|
||||
case 0x005:
|
||||
//LOG("Sound Bias Register write: %08X %02X\n", addr, val);
|
||||
break;
|
||||
case 0x008:
|
||||
//LOG("Sound Capture 0 Control Register write: %02X\n", val);
|
||||
break;
|
||||
case 0x009:
|
||||
//LOG("Sound Capture 1 Control Register write: %02X\n", val);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
T1WriteByte(MMU.ARM7_REG, addr, val);
|
||||
|
@ -397,6 +498,48 @@ void SPU_WriteWord(u32 addr, u16 val)
|
|||
{
|
||||
SPU_core->WriteWord(addr,val);
|
||||
if(SPU_user) SPU_user->WriteWord(addr,val);
|
||||
|
||||
switch (addr & 0xF)
|
||||
{
|
||||
case 0x0:
|
||||
//LOG("Sound Channel %d Volume/data shift/hold write: %04X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x2:
|
||||
//LOG("Sound Channel %d Panning/Wave Duty/Repeat Mode/Format/Start write: %04X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x4:
|
||||
case 0x6:
|
||||
//LOG("Sound Channel %d Data Source Register write: %08X %04X\n",(addr >> 4) & 0xF, addr, val);
|
||||
break;
|
||||
case 0x8:
|
||||
//LOG("Sound Channel %d Timer Register write: %04X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0xA:
|
||||
//LOG("Sound Channel %d Loop start Register write: %04X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0xC:
|
||||
case 0xE:
|
||||
// LOG("Sound Channel %d Length Register write: %08X %04X\n",(addr >> 4) & 0xF, addr, val);
|
||||
break;
|
||||
default:
|
||||
// LOG("Unsupported Sound Register word write: %08X %02X\n", addr, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (addr & 0x1F)
|
||||
{
|
||||
case 0x000:
|
||||
// LOG("Sound Control Register write: %04X\n", val);
|
||||
break;
|
||||
case 0x004:
|
||||
// LOG("Sound Bias Register write: %04X\n", val);
|
||||
break;
|
||||
case 0x008:
|
||||
// LOG("Sound Capture 0/1 Control Register write: %04X\n", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
T1WriteWord(MMU.ARM7_REG, addr, val);
|
||||
|
@ -445,6 +588,37 @@ void SPU_WriteLong(u32 addr, u32 val)
|
|||
{
|
||||
SPU_core->WriteLong(addr,val);
|
||||
if(SPU_user) SPU_user->WriteLong(addr,val);
|
||||
|
||||
switch (addr & 0xF)
|
||||
{
|
||||
case 0x0:
|
||||
//LOG("Sound Channel %d long write: %08X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x4:
|
||||
//LOG("Sound Channel %d Data Source Register long write: %08X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0x8:
|
||||
//LOG("Sound Channel %d Timer/Loop Start Register write: - %08X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
case 0xC:
|
||||
//LOG("Sound Channel %d Length Register long write: %08X\n", (addr >> 4) & 0xF, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (addr & 0x1F)
|
||||
{
|
||||
case 0x000:
|
||||
//LOG("Sound Control Register write: %08X\n", val);
|
||||
break;
|
||||
case 0x004:
|
||||
//LOG("Sound Bias Register write: %08X\n", val);
|
||||
break;
|
||||
case 0x008:
|
||||
//LOG("Sound Capture 0/1 Control Register write: %08X\n", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
T1WriteLong(MMU.ARM7_REG, addr, val);
|
||||
|
@ -961,10 +1135,7 @@ static void SPU_MixAudio(SPU_struct *SPU, int length)
|
|||
u8 vol;
|
||||
|
||||
if(actuallyMix)
|
||||
{
|
||||
memset(SPU->sndbuf, 0, length*4*2);
|
||||
memset(SPU->outbuf, 0, length*2*2);
|
||||
}
|
||||
|
||||
// If the sound speakers are disabled, don't output audio
|
||||
if(!(T1ReadWord(MMU.ARM7_REG, 0x304) & 0x01))
|
||||
|
@ -1290,7 +1461,6 @@ void spu_savestate(std::ostream* os)
|
|||
write16le(chan.pcm16b,os);
|
||||
write16le(chan.pcm16b_last,os);
|
||||
write32le(chan.index,os);
|
||||
write16le(chan.x,os);
|
||||
write16le(chan.psgnoise_last,os);
|
||||
}
|
||||
}
|
||||
|
@ -1326,7 +1496,6 @@ bool spu_loadstate(std::istream* is)
|
|||
read16le(&chan.pcm16b,is);
|
||||
read16le(&chan.pcm16b_last,is);
|
||||
read32le(&chan.index,is);
|
||||
read16le(&chan.x,is);
|
||||
read16le(&chan.psgnoise_last,is);
|
||||
|
||||
//fixup the pointers which we had are supposed to keep cached
|
|
@ -312,12 +312,6 @@ TEMPLATE static u32 wait4IRQ()
|
|||
return 1;
|
||||
}
|
||||
|
||||
TEMPLATE static u32 sleep()
|
||||
{
|
||||
_MMU_write08(cpu->proc_ID, 0x04000301, 0xC0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TEMPLATE static u32 divide()
|
||||
{
|
||||
s32 num = (s32)cpu->R[0];
|
||||
|
@ -1065,7 +1059,7 @@ u32 (* ARM7_swi_tab[32])()={
|
|||
intrWaitARM<ARMCPU_ARM7>, // 0x04
|
||||
waitVBlankARM<ARMCPU_ARM7>, // 0x05
|
||||
wait4IRQ<ARMCPU_ARM7>, // 0x06
|
||||
sleep<ARMCPU_ARM7>, // 0x07
|
||||
wait4IRQ<ARMCPU_ARM7>, // 0x07
|
||||
SoundBias<ARMCPU_ARM7>, // 0x08
|
||||
divide<ARMCPU_ARM7>, // 0x09
|
||||
bios_nop<ARMCPU_ARM7>, // 0x0A
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue