Tacked GPL into comments. More hq4x tweaks.
This commit is contained in:
parent
7487c3b31b
commit
8dee572c9d
8 changed files with 404 additions and 340 deletions
|
|
@ -3,6 +3,22 @@
|
|||
/* printing support for Tux Paint */
|
||||
/* Marcin 'Shard' Konicki <shard at beosjournal.org> */
|
||||
|
||||
/*
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Jan. 17, 2003 */
|
||||
|
||||
#include "BeOS_print.h"
|
||||
|
|
|
|||
|
|
@ -172,12 +172,13 @@
|
|||
|
||||
|
||||
void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||
int RGBtoYUV[65536])
|
||||
Uint32 RGBtoYUV[65536])
|
||||
{
|
||||
int x, y, k;
|
||||
int prevline, nextline;
|
||||
Uint16 w[10];
|
||||
Uint8 a;
|
||||
Uint32 YUV1, YUV2;
|
||||
int pattern;
|
||||
int flag;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
#include "SDL.h"
|
||||
|
||||
void hq4x_32(SDL_Surface * src, SDL_Surface * dest,
|
||||
int RGBtoYUV[65536]);
|
||||
Uint32 RGBtoYUV[65536]);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
12
src/hqxx.c
12
src/hqxx.c
|
|
@ -165,7 +165,7 @@ void hqxx_putpixel(SDL_Surface * surface, int x, int y, Uint16 pixel, Uint8 alph
|
|||
|
||||
|
||||
|
||||
void InitLUTs(int * RGBtoYUV)
|
||||
void InitLUTs(Uint32 * RGBtoYUV)
|
||||
{
|
||||
int i, j, k, r, g, b, Y, u, v;
|
||||
|
||||
|
|
@ -181,9 +181,7 @@ void InitLUTs(int * RGBtoYUV)
|
|||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||
RGBtoYUV[(i << 11) + (j << 5) + k] = (((Y & 0xF8) << 8) |
|
||||
((u & 0xFE) << 3) |
|
||||
(v >> 3));
|
||||
RGBtoYUV[(i << 11) + (j << 5) + k] = (Y << 16) + (u << 8) + v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,15 +208,11 @@ inline void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint
|
|||
{
|
||||
Uint32 c;
|
||||
|
||||
/* FIXME? */
|
||||
|
||||
// c = (c1 * 2 + c2 + c3) >> 2;
|
||||
|
||||
c = ((((c1 & 0x07E0) * 2 + (c2 & 0x07E0) + (c3 & 0x07E0)) & (0x07E0 << 2)) +
|
||||
(((c1 & 0xF81F) * 2 + (c2 & 0xF81F) + (c3 & 0xF81F)) & (0xF81F << 2)))
|
||||
>> 2;
|
||||
|
||||
|
||||
hqxx_putpixel(dest, x, y, c, alpha);
|
||||
}
|
||||
|
||||
|
|
@ -252,7 +246,7 @@ inline void Interp4(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint
|
|||
|
||||
c = ((((c1 & 0x07E0) * 2 +
|
||||
((c2 & 0x07E0) +
|
||||
(c3 & 0x07E0)) * 7) & 0x7E00) +
|
||||
(c3 & 0x07E0)) * 7) & 0x07E00) +
|
||||
(((c1 & 0xF81F) * 2 +
|
||||
((c2 & 0xF81F) +
|
||||
(c3 & 0xF81F)) * 7) & 0xF81F0)) >> 4;
|
||||
|
|
|
|||
24
src/hqxx.h
24
src/hqxx.h
|
|
@ -27,23 +27,25 @@
|
|||
|
||||
#include "SDL.h"
|
||||
|
||||
static int YUV1, YUV2;
|
||||
#define Ymask 0x00FF0000
|
||||
#define Umask 0x0000FF00
|
||||
#define Vmask 0x000000FF
|
||||
|
||||
#define Ymask 0xF800
|
||||
#define Umask 0x07E0
|
||||
#define Vmask 0x001F
|
||||
//#define Ymask 0xF800
|
||||
//#define Umask 0x07E0
|
||||
//#define Vmask 0x001F
|
||||
|
||||
//trY in 32 = 0x00300000
|
||||
//trU in 32 = 0x00000700
|
||||
//trV in 32 = 0x00000006
|
||||
#define trY 0x00300000
|
||||
#define trU 0x00000700
|
||||
#define trV 0x00000006
|
||||
|
||||
#define trY 0x3000
|
||||
#define trU 0x00C0
|
||||
#define trV 0x0006
|
||||
//#define trY 0x3000
|
||||
//#define trU 0x00C0
|
||||
//#define trV 0x0006
|
||||
|
||||
|
||||
Uint16 hqxx_getpixel(SDL_Surface * surface, int x, int y, Uint8 * alpha);
|
||||
void InitLUTs(int * RGBtoYUV);
|
||||
void InitLUTs(Uint32 * RGBtoYUV);
|
||||
inline void Interp0(SDL_Surface * dest, int x, int y, Uint16 c, Uint8 alpha);
|
||||
inline void Interp1(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint8 alpha);
|
||||
inline void Interp2(SDL_Surface * dest, int x, int y, Uint16 c1, Uint16 c2, Uint16 c3, Uint8 alpha);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,20 @@
|
|||
bill@newbreedsoftware.com
|
||||
http://www.newbreedsoftware.com/tuxpaint/
|
||||
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
June 14, 2002 - December 20, 2003
|
||||
*/
|
||||
|
||||
|
|
@ -24,6 +38,9 @@
|
|||
/* #define USE_HWSURFACE */
|
||||
|
||||
|
||||
/* #define USE_HQ4X */
|
||||
|
||||
|
||||
/* Disable fancy cursors in fullscreen mode, to avoid SDL bug: */
|
||||
#define LARGE_CURSOR_FULLSCREEN_BUG
|
||||
|
||||
|
|
@ -2990,6 +3007,7 @@ void stamp_draw(int x, int y)
|
|||
|
||||
/* Shrink or grow it! */
|
||||
|
||||
#ifdef HQ4X
|
||||
if (state_stamps[cur_stamp]->size == 400)
|
||||
{
|
||||
/* Use high quality 4x filter! */
|
||||
|
|
@ -3024,6 +3042,7 @@ void stamp_draw(int x, int y)
|
|||
hq4x_32(tmp_surf, final_surf, RGBtoYUV);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
final_surf = thumbnail(tmp_surf,
|
||||
(tmp_surf->w *
|
||||
|
|
|
|||
|
|
@ -11,6 +11,22 @@
|
|||
/* */
|
||||
/****************************************************/
|
||||
|
||||
/*
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,22 @@
|
|||
|
||||
/* John Popplewell <john@johnnypops.demon.co.uk> */
|
||||
|
||||
/*
|
||||
This program 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.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Sept. 30, 2002 - Oct. 17, 2002 */
|
||||
/* Oct. 07, 2003 - added banding support */
|
||||
/* - prints using 24-bit (not 32-bit) bitmap */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue