1.Cè¯è¨ 解读ä¸å代ç
2.VC++6.0 getimage ä¸ç´function does not take 2 parameters
3.å¦ä½å°å±å¹ä¸ä¸äºç¹åå¨å
åä¸ï¼
4.java.awt.Imageç±»
Cè¯è¨ 解读ä¸å代ç
getimage() ä¿åå¾åå½æ°
åè½ï¼ å½æ°getimage()ä¿åå·¦ä¸è§ä¸å³ä¸è§æå®ä¹çå±å¹ä¸åç´ å¾å½¢å°æå®çå ååºåã
ç¨æ³ï¼ 该å½æ°è°ç¨æ¹å¼ä¸ºvoid getimage(int left,函数函数榴弹枪源码配置最新int top,int right,int bottom,void *buf);
说æï¼ å½æ°ä¸åæ°(left,top)为è¦ä¿åçå¾åå±å¹çå·¦ä¸è§ï¼(right,bottom)ä¸ºå ¶å³ä¸è§ï¼bufæåä¿åå¾åçå åå°åãè°ç¨getimage()ä¿åå±å¹å¾åï¼å¯ç¨imagesize()å½æ°ç¡®å®ä¿åå¾åæéåèæ°ï¼åç¨malloc()å½æ°åé åå¨å¾åçå å(å ååé å¿ é¡»å°äºKB)ï¼è¿å¯ä»¥ç¨ä¸é¢å½æ°putimage()è¾åºgetimage()ä¿åçå±å¹å¾åã
è¿ä¸ªå½æ°å¯¹åºç头æ件为graphics.h
è¿åå¼ï¼ æ
VC++6.0 getimage ä¸ç´function does not take 2 parameters
æ¤å½æ°ä¸æ¥å两个åæ°ï¼ä½ çåæ°ä¼ éæé®é¢ãè¾å ¥getimage(å¯ä»¥èªå¨æ¾ç¤ºææå¯ç¨çåæ°å½¢å¼ã
å¦ä½å°å±å¹ä¸ä¸äºç¹åå¨å åä¸ï¼
æè¿ä¸ªæ¯Cè¯è¨ç.
使ç¨getimageå½æ°å®ç°
void far getimage(int left, int top, int right, int bottom, void far *bitmap); åæ°ä¾æ¬¡ä¸ºå·¦Xåæ ,ä¸Yåæ ,å³Xåæ ,ä¸Yåæ ,å°å´æçç©å½¢åå°bitmapææçå ååºåå
å æå¾ç»å¥½äº,ä¿åå°å åä¸,åæ¸ å±.使ç¨å¾ªç¯å°å åéçä½å¾æ¾å°å±å¹ä¸(使ç¨putimageå½æ°),æçä¼é«å¾å¤,以ä¸æ¯ç¼ç¨å®ä¾:
#include "stdio.h"
#include <graphics.h>
main()
{ int n;
int i,j,gdriver,gmode,size;
void *buf;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"");
setbkcolor(BLUE);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,0);
setfillstyle(1,BROWN);
circle(,,);
floodfill(,,);
size=imagesize(,,,);
buf=malloc(size);
getimage(,,,,buf);
setbkcolor(BLACK);
cleardevice();
line(,,,);
printf("Please input circulation's frequency:\n");/*è¾å ¥å¾ªç¯æ¬¡æ°*/
scanf("%d",&n);
for(j=0;j<n;j++)
{ for(i=0; i<; i++){
putimage(i,,buf,COPY_PUT);
}
line(,,,);
for(i=0;i<;i++){
putimage(-i,, buf, COPY_PUT);
line(,,,);}
}
getch();
closegraph();
}
æ¤ç¨åºè¦æ±è¾å ¥ä¸ä¸ªå¾ªç¯æ¬¡æ°ä»¥åå³å¯å®ç°å°ççæ»å¨,åä½ è¦è§£å³çé®é¢ç±»ä¼¼
java.awt.Imageç±»
public Image getImage(URL url, String name)
è¿åè½è¢«ç»å¶å°å±å¹ä¸ç Image 对象ãurl åæ°å¿ é¡»æå®ç»å¯¹ URLãname åæ°æ¯ç¸å¯¹äº url åæ°ç说æ符ã
ä¸ç®¡å¾ååå¨ä¸å¦ï¼æ¤æ¹æ³æ»æ¯ç«å»è¿åãå½æ¤ applet è¯å¾å¨å±å¹ä¸ç»å¶å¾åæ¶ï¼æ°æ®å°è¢«å è½½ãç»å¶å¾åçå¾å½¢å¾å å°éæ¸ç»å¶å°å±å¹ä¸ã
åæ°ï¼
url - ç»åºå¾ååºæ¬ä½ç½®çç»å¯¹ URLã
name - ç¸å¯¹äº url åæ°çå¾è±¡ä½ç½®ã
è¿åï¼
æå® URL å¤çå¾åã
public abstract boolean drawImage(Image img, int x, int y, ImageObserver observer)
ç»å¶æå®å¾åä¸å½åå¯ç¨çå¾åãå¾åçå·¦ä¸è§ä½äºè¯¥å¾å½¢ä¸ä¸æåæ 空é´ç (x, y)ãå¾åä¸çéæåç´ ä¸å½±å该å¤å·²åå¨çåç´ ã
æ¤æ¹æ³å¨ä»»ä½æ åµä¸é½ç«å»è¿åï¼çè³å¨å¾åå°æªå®æ´å è½½ï¼å¹¶ä¸è¿æ²¡æé对å½åè¾åºè®¾å¤å®ææå¨å转æ¢çæ åµä¸ä¹æ¯å¦æ¤ã
å¦æå¾åå·²ç»å®æ´å è½½ï¼å¹¶ä¸å ¶åç´ ä¸ååçæ´æ¹ï¼å drawImage è¿å trueãå¦åï¼drawImage è¿å falseï¼å¹¶ä¸éçæ´å¤çå¾åå¯ç¨æè å°äºç»å¶å¨ç»å¦ä¸å¸§çæ¶åï¼å è½½å¾åçè¿ç¨å°éç¥æå®çå¾åè§å¯è ã
åæ°ï¼
img - è¦ç»å¶çæå®å¾åãå¦æ img 为 nullï¼åæ¤æ¹æ³ä¸æ§è¡ä»»ä½æä½ã
x - x åæ ã
y - y åæ ã
observer - 转æ¢äºæ´å¤å¾åæ¶è¦éç¥ç对象ã
è¿åï¼
å¦æå¾ååç´ ä»å¨æ´æ¹ï¼åè¿å falseï¼å¦åè¿å trueã