PDA

Tam Sürümünü Görmek İçin : c builder resim parcalama


sebnemkaya86
25/05/2007, 20:28
:confused: C BUILDER PROGRAMINDA RESİM PARCALAMAK İSTİYORUM
BİR RESMİ İSTEDİGİM ADET DE BÖLDÜRMEYE CALISICAGIM AMA BÖLMEK İÇİN KOMUTU BILMIYORUM YARDIM ISTIYORUM ..RİCA EDİYORUM SİZLERDEN CEVAP BEKLIYORUM SON CARE ..


acehreli
25/05/2007, 20:59
Bilenler mutlaka yardim edecektir. Ama lutfen gozlerimizi buyuk harflerden ve renkli yazilardan koru. :D

Ali

x1bx00x0a
25/05/2007, 23:48
İlk kaynak kod sadece anlamanı sağlamak içindir. Aynı zamanda en altta verdiğim Kaynak linkindede Açıklamasını bulabilirsin...

Detaylı kaynak bağlantısı algılamanı sağlayacaktır. Algılamada sorun çıkabileceğini göz önünde bulundurarak fazladan 2 kaynak daha ekledim. Umarım işine yarar...


int crop(imgdes *image1)
{
imgdes timage;
int dx1, dy1, dx2, dy2, rcode, pct = 63; // 63% percent of original size

// Allocate space for the new DIB
dx1 = image1->endx - image1->stx + 1;
dy1 = image1->endy - image1->sty + 1;
dx2 = (int)((long)(dx1) * pct / 100);
dy2 = (int)((long)(dy1) * pct / 100);
if((rcode = allocimage(&timage, dx2, dy2, image1->bmh->biBitCount)) == NO_ERROR) {
image1->stx = (dx1-dx2)/2;
image1->sty = (dy1-dy2)/2;
image1->endx = image1->stx + dx2 - 1;
image1->endy = image1->sty + dy2 - 1;
// Copy image area into timage
if((rcode = copyimage(image1, &timage)) == NO_ERROR) {
// Success, free source image
freeimage(image1);
// Assign timage to image1
copyimgdes(&timage, image1);
}
else // Error in resizing image, release timage memory
freeimage(&timage);
}
return(rcode);
}

int crop_and_save(imgdes *image1)
{
imgdes timage;
int dx1, dy1, dx2, dy2, rcode, pct = 63; // 63% percent of original size
int stx, sty, endy, endy;

// Calculate size of area to save
dx1 = image1->endx - image1->stx + 1;
dy1 = image1->endy - image1->sty + 1;
dx2 = (int)((long)(dx1) * pct / 100);
dy2 = (int)((long)(dy1) * pct / 100);
// Save coordinates of original area of interest
stx = image1->stx;
sty = image1->sty;
endx = image1->endx;
endy = image1->endy;
// Set area of interest to center 63% of image
image1->stx = (dx1-dx2)/2;
image1->sty = (dy1-dy2)/2;
image1->endx = image1->stx + dx2 - 1;
image1->endy = image1->sty + dy2 - 1;
// Save area of interest in TIFF image file
rcode = savetif("test.tif", image1, 0);
// Restore area of interest
image1->stx = stx;
image1->sty = sty;
image1->endx = endx;
image1->endy = endy;
return(rcode);
}


Kaynak: http://www.catenary.com/howto/crop.html#C_source
Detaylı kayak:http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/crop.c
Daha detaylı kaynak:http://swtch.com/usr/local/plan9/src/cmd/draw/crop.c
en detaylı kaynak:http://www.google.com.tr/search?hl=tr&client=firefox-a&rls=org.mozilla%3Atr-TR%3Aofficial&hs=GwL&q=crop+filetype%3Ac&btnG=Ara&meta=


DipNot: Coder'ı
1. Linux
2. C
3. C ile resim işleme öldürür Büyük ve renkli yazı süründürür...

=)