12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118 |
- {
- Free Pascal port of the Hermes C library.
- Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
- Original C version by Christian Nentwich ([email protected])
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library 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
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- }
- {
- Generic format conversion routines for the HERMES library
- Copyright (c) 1998 Christian Nentwich ([email protected])
- This source code is licensed under the GNU LGPL
- Please refer to the file COPYING.LIB contained in the distribution for
- licensing conditions
- }
- Procedure ConvertP_Generic32_Generic32(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pint32(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(source, 4);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic24(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, dest : Pchar8;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pint32(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest+R_24)^ := (d_ptr+R_32)^;
- (dest+G_24)^ := (d_ptr+G_32)^;
- (dest+B_24)^ := (d_ptr+B_32)^;
- Inc(source, 4);
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic16(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width Shr 1;
- If count <> 0 Then
- Repeat
- r := (((Pint32(source)^) Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := (((Pint32(source)^) Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := (((Pint32(source)^) Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := (r Or g Or b) And $FFFF;
- r := ((((Pint32(source)+1)^) Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((((Pint32(source)+1)^) Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((((Pint32(source)+1)^) Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := s_pixel Or ((r Or g Or b) Shl 16);
- Pint32(dest)^ := s_pixel;
- Inc(source, 8);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- { Trailing pixel }
- If (iface^.s_width And 1) <> 0 Then
- Begin
- r := (((Pint32(source)^) Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := (((Pint32(source)^) Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := (((Pint32(source)^) Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(dest, 2);
- Inc(source, 4);
- End;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic8(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pint32(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(source, 4);
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic32(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := (((source+R_24)^) Shl 16) Or
- (((source+G_24)^) Shl 8) Or
- ((source+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(source, 3);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic24(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, dest : PChar8;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := (((source+R_24)^) Shl 16) Or
- (((source+G_24)^) Shl 8) Or
- ((source+B_24)^);
- r := ((s_pixel Shl iface^.info.r_left) Shr iface^.info.r_right) And
- iface^.mask_r;
- g := ((s_pixel Shl iface^.info.g_left) Shr iface^.info.g_right) And
- iface^.mask_g;
- b := ((s_pixel Shl iface^.info.b_left) Shr iface^.info.b_right) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest + R_24)^ := (d_ptr + R_32)^;
- (dest + G_24)^ := (d_ptr + G_32)^;
- (dest + B_24)^ := (d_ptr + B_32)^;
- Inc(source, 3);
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic16(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := (((source+R_24)^) Shl 16) Or
- (((source+G_24)^) Shl 8) Or
- ((source+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(source, 3);
- Inc(dest, 2);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic8(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := (((source+R_24)^) Shl 16) Or
- (((source+G_24)^) Shl 8) Or
- ((source+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(source, 3);
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic32(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pshort16(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(source, 2);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic24(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, dest : Pchar8;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pshort16(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest + R_24)^ := (d_ptr + R_32)^;
- (dest + G_24)^ := (d_ptr + G_32)^;
- (dest + B_24)^ := (d_ptr + B_32)^;
- Inc(source, 2);
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic16(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pshort16(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(source, 2);
- Inc(dest, 2);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic8(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- Begin
- source := iface^.s_pixels; dest := iface^.d_pixels;
- Repeat
- count := iface^.s_width;
- Repeat
- s_pixel := Pshort16(source)^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(source, 2);
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(source, iface^.s_add);
- Inc(dest, iface^.d_add);
- Dec(iface^.s_height);
- Until iface^.s_height = 0;
- End;
- Procedure ConvertP_Generic8_Generic32(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic24(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic16(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic8(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- { -------------------------------------------------------------------------
- STRETCH CONVERTERS
- ------------------------------------------------------------------------- }
- Procedure ConvertP_Generic32_Generic32_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pint32(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic24_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pint32(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest + R_24)^ := (d_ptr + R_32)^;
- (dest + G_24)^ := (d_ptr + G_32)^;
- (dest + B_24)^ := (d_ptr + B_32)^;
- Inc(x, dx);
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic16_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pint32(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest, 2);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic32_Generic8_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pint32(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic32_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, src, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- src := source;
- Repeat
- s_pixel := (((src+R_24)^) Shl 16) Or
- (((src+G_24)^) Shl 8) Or
- ((src+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- x := x And $FFFF;
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic24_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, src, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- src := source;
- Repeat
- s_pixel := (((src+R_24)^) Shl 16) Or
- (((src+G_24)^) Shl 8) Or
- ((src+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest + R_24)^ := (d_ptr + R_32)^;
- (dest + G_24)^ := (d_ptr + G_32)^;
- (dest + B_24)^ := (d_ptr + B_32)^;
- Inc(x, dx);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- x := x And $FFFF;
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic16_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, src, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- src := source;
- Repeat
- s_pixel := (((src+R_24)^) Shl 16) Or
- (((src+G_24)^) Shl 8) Or
- ((src+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- x := x And $FFFF;
- Inc(dest, 2);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic24_Generic8_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, src, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- src := source;
- Repeat
- s_pixel := (((src+R_24)^) Shl 16) Or
- (((src+G_24)^) Shl 8) Or
- ((src+B_24)^);
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(x, dx);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- Inc(src, x Shr 16);
- x := x And $FFFF;
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic32_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pshort16(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pint32(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest, 4);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic24_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- d_ptr : Pchar8;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- d_ptr := @s_pixel;
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pshort16(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- s_pixel := r Or g Or b;
- (dest + R_24)^ := (d_ptr + R_32)^;
- (dest + G_24)^ := (d_ptr + G_32)^;
- (dest + B_24)^ := (d_ptr + B_32)^;
- Inc(x, dx);
- Inc(dest, 3);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic16_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pshort16(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- Pshort16(dest)^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest, 2);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic16_Generic8_S(iface : PHermesConverterInterface); CDecl;
- Var
- s_pixel, r, g, b : int32;
- count : DWord;
- source, dest : Pchar8;
- dx, dy, x, y : DWord;
- Begin
- source := iface^.s_pixels;
- dest := iface^.d_pixels;
- dy := (iface^.s_height Shl 16) Div iface^.d_height;
- dx := (iface^.s_width Shl 16) Div iface^.d_width;
- y := 0;
- Repeat
- count := iface^.d_width;
- x := 0;
- Repeat
- s_pixel := (Pshort16(source)+(x Shr 16))^;
- r := ((s_pixel Shr iface^.info.r_right) Shl iface^.info.r_left) And
- iface^.mask_r;
- g := ((s_pixel Shr iface^.info.g_right) Shl iface^.info.g_left) And
- iface^.mask_g;
- b := ((s_pixel Shr iface^.info.b_right) Shl iface^.info.b_left) And
- iface^.mask_b;
- dest^ := r Or g Or b;
- Inc(x, dx);
- Inc(dest);
- Dec(count);
- Until count = 0;
- Inc(dest, iface^.d_add);
- Inc(y, dy);
- Inc(source, (y Shr 16)*DWord(iface^.s_pitch));
- y := y And $ffff;
- Dec(iface^.d_height);
- Until iface^.d_height = 0;
- End;
- Procedure ConvertP_Generic8_Generic32_S(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic24_S(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic16_S(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
- Procedure ConvertP_Generic8_Generic8_S(iface : PHermesConverterInterface); CDecl;
- Begin
- {todo}
- End;
|