[c++ builder] jpg afdrukken

Pagina: 1
Acties:

  • bartvdl
  • Registratie: December 2001
  • Laatst online: 27-07-2022
zou iemand mij kunnen vertellen hoe ik een jpg plaatje kan afdrukken? direct uit een bestand of via TImage, dat maakt niet uit.

  • LordLarry
  • Registratie: Juli 2001
  • Niet online

LordLarry

Aut disce aut discede

Hier een gratis stukje code waarover ik toevallig struikelde ;)

C:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    unsigned int BitmapInfoSize, BitmapImageSize;
    long DIBWidth, DIBHeight;
    PChar BitmapImage;
    Windows::PBitmapInfo BitmapInfo;
    Graphics::TBitmap *Bitmap;

    Printer()->BeginDoc();

    Bitmap = new Graphics::TBitmap();
    Bitmap->Assign(Image->Picture);
    GetDIBSizes(Bitmap->Handle, BitmapInfoSize, BitmapImageSize);
    BitmapInfo = (PBitmapInfo) new char[BitmapInfoSize];
    BitmapImage = (PChar) new char [BitmapImageSize];
    GetDIB(Bitmap->Handle, 0, BitmapInfo, BitmapImage);
    DIBWidth = BitmapInfo->bmiHeader.biWidth;
    DIBHeight = BitmapInfo->bmiHeader.biHeight;
    StretchDIBits(Printer()->Canvas->Handle,
                0, 0, DIBWidth, DIBHeight,
                0, 0, DIBWidth, DIBHeight,
                BitmapImage, BitmapInfo,
                DIB_RGB_COLORS, SRCCOPY);
    delete [] BitmapImage;
    delete [] BitmapInfo;
    delete Bitmap;

    Printer()->EndDoc();

We adore chaos because we like to restore order - M.C. Escher


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 13-08 16:46

curry684

left part of the evil twins

En waarom die omweg en niet gewoon een TJPEGImage drawen op Printer()->Canvas? :?

Professionele website nodig?


  • LordLarry
  • Registratie: Juli 2001
  • Niet online

LordLarry

Aut disce aut discede

Dat schijnt niet helemaal ok te gaan ofzo...

We adore chaos because we like to restore order - M.C. Escher


  • bartvdl
  • Registratie: December 2001
  • Laatst online: 27-07-2022
Bedankt, ik heb het opgelost met StretchDraw op de Printer canvas