Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 20-10-2005
rounin rounin is offline
Miembro
 
Registrado: sep 2005
Posts: 43
Poder: 0
rounin Va por buen camino
Un pixel - un bit.

Código Delphi [-]
 
function GetMonoPixel(P: PArrayOfByte; I: Integer): TColor;
const Colors: array[0..1]of TColor = (clBlack, clWhite);
var NByte, nbit: Integer;
    ByteN: Byte;
begin
  NByte := I div 8;
  nbit := 7 - (I - NByte*8);
  ByteN := P^[NByte];
  Result := Colors[  (ByteN shr nbit) and 1  ];
end;

procedure SetMonoPixel(P: PArrayOfByte; I: Integer; Value: TColor);
var NByte, nbit: Integer;
    ByteN: Byte;
begin
  NByte := I div 8;
  nbit := 7 - (I - NByte*8);
  ByteN := P^[NByte];
  case Value of
    clWhite: ByteN := ByteN or (1 shl nbit);
    clBlack: ByteN := ByteN and (not(1 shl nbit))
    else raise Exception.Create('Only white or black!');
  end;
  P^[NByte] := ByteN;
end;
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 16:35:29.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi