# [SDL] Re: Simple font resize with blend

Riccardo t1t0 at tiscali.it
Wed Jan 29 16:49:03 PST 2003

```thank for your patience

> Any image?  And having your destination rect being a smaller size than your source rect when blitting doesn't cut it?

I will get the right ratio for soure image resizing...

> When I've played around with it, as long as you keep the ratios fairly normal between to two rects, it usually looks pretty sharp to me.  Different ratios for a reduced size do better than others, so try playing around with that and see if it works for you.

> Otherwise, yes, the logic you are using will have to be done for RGB values... you just have to remember that color info is stored in different ways so double check your settings and you'll have to manipulate the color by seperately adding each color channel and then combining them to your single Uint that stores the color.  Something like:
>
> If you have RGBs for pixel 1, and RGB for pixel 2... then...
>
> Uint24 R = (R1>>1)+(R2>>1); //bit shift x right 1 == x/2
> Uint24 G = (G1>>1)+(R2>>1);
> Uint24 B = (B1>>1)+(R2>>1);
>
> RGB = (R<<16)&(G<<8)&(B);  //if color is in 24 bit 0x(R)(G)(B) format
>
An Uint24 is equal to html color code, is right?
It have 8 bit for each color (#ffffff is 255 red, 255 green and 255
blue, and with 8 bit i have 256 char...)

well,
but how can I work with a Uint24?

If I have a Uint24 pixel
is this a right example for a red color?
111111110000000000000000
24 bit
8 for red,
8 for greeen and
8 for blue?

then

Uint24 pixel = the pixel that i have

Uint8 Red = pixel<<16; // I can't use an Uint8? a single color have only
8 bits? with this shift is Red==000000000000000011111111 ?

I understand?

> I'd just play around with it and make sure you manipulate the right bits with the right formats, but that should do it... or something like that.
>
> - Joby
> http://jobybednar.com
> Give someone a program - frustrate them for a day.
> Teach them how to program - frustrate them for a lifetime.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030129/aa242c8e/attachment-0008.pgp>
```