Ir para conteúdo
  • Cadastre-se

Robson Alves

Membros
  • Total de ítens

    9
  • Registro em

  • Última visita

Últimos Visitantes

181 visualizações

Robson Alves's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputação

  1. Resolvido , encontrei o método que faz o código direto na impressora pode encerrar essa pergunta. Para quem precisar é só usar : ETQ_ImprimirQRCode( Vertical, Horizontal, Texto, LarguraModulo, ErrorLevel, Tipo );
  2. encontrei essa forma na net -> public static Bitmap ConvertTo1Bit(Bitmap input) { var masks = new byte[] { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; var output = new Bitmap(input.Width, input.Height, PixelFormat.Format1bppIndexed); var data = new sbyte[input.Width, input.Height]; var inputData = input.LockBits(new Rectangle(0, 0, input.Width, input.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); try { var scanLine = inputData.Scan0; var line = new byte[inputData.Stride]; for (var y = 0; y < inputData.Height; y++, scanLine += inputData.Stride) { Marshal.Copy(scanLine, line, 0, line.Length); for (var x = 0; x < input.Width; x++) { data[x, y] = (sbyte)(64 * (GetGreyLevel(line[x * 3 + 2], line[x * 3 + 1], line[x * 3 + 0]) - 0.5)); } } } finally { input.UnlockBits(inputData); } var outputData = output.LockBits(new Rectangle(0, 0, output.Width, output.Height), ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed); try { var scanLine = outputData.Scan0; for (var y = 0; y < outputData.Height; y++, scanLine += outputData.Stride) { var line = new byte[outputData.Stride]; for (var x = 0; x < input.Width; x++) { var j = data[x, y] > 0; if (j) line[x / 8] |= masks[x % 8]; var error = (sbyte)(data[x, y] - (j ? 32 : -32)); if (x < input.Width - 1) data[x + 1, y] += (sbyte)(7 * error / 16); if (y < input.Height - 1) { if (x > 0) data[x - 1, y + 1] += (sbyte)(3 * error / 16); data[x, y + 1] += (sbyte)(5 * error / 16); if (x < input.Width - 1) data[x + 1, y + 1] += (sbyte)(1 * error / 16); } } Marshal.Copy(line, 0, scanLine, outputData.Stride); } } finally { output.UnlockBits(outputData); } return output; } public static double GetGreyLevel(byte r, byte g, byte b) { return (r * 0.299 + g * 0.587 + b * 0.114) / 255; } //aqui chamo o método A.Save("c:/teste/myBitmap2.bmp"); ConvertTo1Bit(A); // com o caminha da imagem como pegar o retorno em bmp 1bit ??????
  3. encontrei essa forma na net -> public static Bitmap ConvertTo1Bit(Bitmap input) { var masks = new byte[] { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; var output = new Bitmap(input.Width, input.Height, PixelFormat.Format1bppIndexed); var data = new sbyte[input.Width, input.Height]; var inputData = input.LockBits(new Rectangle(0, 0, input.Width, input.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); try { var scanLine = inputData.Scan0; var line = new byte[inputData.Stride]; for (var y = 0; y < inputData.Height; y++, scanLine += inputData.Stride) { Marshal.Copy(scanLine, line, 0, line.Length); for (var x = 0; x < input.Width; x++) { data[x, y] = (sbyte)(64 * (GetGreyLevel(line[x * 3 + 2], line[x * 3 + 1], line[x * 3 + 0]) - 0.5)); } } } finally { input.UnlockBits(inputData); } var outputData = output.LockBits(new Rectangle(0, 0, output.Width, output.Height), ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed); try { var scanLine = outputData.Scan0; for (var y = 0; y < outputData.Height; y++, scanLine += outputData.Stride) { var line = new byte[outputData.Stride]; for (var x = 0; x < input.Width; x++) { var j = data[x, y] > 0; if (j) line[x / 8] |= masks[x % 8]; var error = (sbyte)(data[x, y] - (j ? 32 : -32)); if (x < input.Width - 1) data[x + 1, y] += (sbyte)(7 * error / 16); if (y < input.Height - 1) { if (x > 0) data[x - 1, y + 1] += (sbyte)(3 * error / 16); data[x, y + 1] += (sbyte)(5 * error / 16); if (x < input.Width - 1) data[x + 1, y + 1] += (sbyte)(1 * error / 16); } } Marshal.Copy(line, 0, scanLine, outputData.Stride); } } finally { output.UnlockBits(outputData); } return output; } public static double GetGreyLevel(byte r, byte g, byte b) { return (r * 0.299 + g * 0.587 + b * 0.114) / 255; } //aqui chamo o método A.Save("c:/teste/myBitmap2.bmp"); ConvertTo1Bit(A); // com o caminha da imagem como pegar o retorno em bmp 1bit ??????
  4. Bom dia , Preciso imprimir um QrCode que gero no c# na impressora codigo de barras, sempre fala que só aceita monocromatica, como transformar em monocromatica a imagem.
  5. Bom dia, não tenho conta e não consegui fazer o cadastro , não tenho empresa, eu só tenho CPF, então o trial não me deixa baixar. Preciso dessa biblioteca só para fazer teste, não teria como enviar para mim por e-mail ???
  6. Bom dia na onde Encontro essa DLL ????? Bom dia na onde Encontro essa DLL ?????
  7. Bom dia preciso de uma ajuda, não consigo compilar o ACBretq com c#, sempre dá esse erro , como posso corrigir esse erro. O erro sempre acontece na ACBrLibHandle.cs e ACBrETQ.cs
×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.

The popup will be closed in 10 segundos...