Home > Back-end >  C builder how to divide the PNG images
C builder how to divide the PNG images

Time:09-26

BCB in how to deduct the part they want a PNG, such as is known to take the x, y, width, height, how to deduct out this part of the figure from the original PNG

CodePudding user response:

A curve approach is to first converted to bitmap, and then processing, ha ha

CodePudding user response:

Turned BMP transparent effect would not be in, mainly to take transparent effect

CodePudding user response:

Calling the TPNGImage

CodePudding user response:

@ OptPhantom call TPNGImage how? How to buckle the part of the figure?

CodePudding user response:

The problem resolved:

Struct pngcropinfo_s
{
PNG TPngImage *;
int x;
int y;
Int w;
Int h;
};
Void __fastcall TPngWrapper: : GetDestImage (TPngImage * Src, TPngImage * DestImg, pictureinfo_t * PIC)
{
PByteArray p1, p2,
PByteArray pa1, pa2;
Int sX, sY, dX, dY;

SY=PIC - & gt; y;
DY=0;
While (sY & lt; (PIC - & gt; Y + PIC & gt; H))
{
If ((sY & gt;=Src - & gt; Height))
break;

SX=PIC - & gt; x;
DX=0;

While (sX & lt; (PIC - & gt; X + PIC & gt; W))
{
If (sX & gt;=Src - & gt; Width) {
break;
}

PByteArray (DestImg - & gt; Scanline [dY]) - & gt; Data [3 * dX]=PByteArray (Src - & gt; Scanline (sY)) - & gt; Data (3 * sX];
PByteArray (DestImg - & gt; Scanline [dY]) - & gt; Data [3 * dX + 1]=PByteArray (Src - & gt; Scanline (sY)) - & gt; Data (3 * x + 1];
PByteArray (DestImg - & gt; Scanline [dY]) - & gt; Data [3 * dX + 2]=PByteArray (Src - & gt; Scanline (sY)) - & gt; Data (3 * x + 2];
PByteArray (DestImg - & gt; AlphaScanline [dY]) - & gt; The data/dX=PByteArray (Src - & gt; AlphaScanline (sY)) - & gt; Data [x];

SX++;
DX++;
}
SY++;
DY++;
}
}
  • Related