int lib_graphics_f_AllocRaster_2(emumsg_syscall_t *msg) { /* Make real syscall */ msg->arg[0]._aptr = AllocRaster( msg->arg[0]._ulong, msg->arg[1]._ulong ); return HOOK_DONE; }
main() { unsigned char str[256], *pp; int i; struct TextAttr ta = { "topaz.font", 8, FS_NORMAL, FPF_ROMFONT }; struct RastPort rp; struct BitMap bm = { 256, /* bytes per row */ 8, /* rows */ 0, /* flags */ 1, /* depth */ 0, /* pad */ 0 }; /* planes */ struct TextFont *tf; InitRastPort (& rp); rp.BitMap = &bm; bm.Planes[0] = pp = AllocRaster (256 * 8, 8); if (!pp) { fprintf (stderr, "Can't allocate raster!\n"); exit (1); } bzero (pp, 256 * 8); tf = OpenFont (& ta); if (! tf) { fprintf (stderr, "can't open topaz font.\n"); exit (1); } SetFont (&rp, tf); /* initialize string to be printed */ for (i = 32; i < 256; i++) str[i - 32] = i; Move (&rp, 0, 6); Text (&rp, str, 256 - 32); { int bin = open ("bitmap", 1); if (bin >= 0) { write (bin, pp, 256*8); close (bin); } } /* dump them.. */ printf ("/* generated automatically by dumpfont.c. *DONT* distribute\n"); printf (" this file, it contains information Copyright by Commodore!\n"); printf ("\n"); printf (" This is the (new) topaz80 system font: */\n\n"); printf ("unsigned char kernel_font_width = 8;\n"); printf ("unsigned char kernel_font_height = 8;\n"); printf ("unsigned char kernel_font_lo = 32;\n"); printf ("unsigned char kernel_font_hi = 255;\n\n"); printf ("unsigned char kernel_cursor[] = {\n"); printf (" 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\n\n"); printf ("unsigned char kernel_font[] = {\n"); for (i = 0; i < 256 - 32; i++) { printf ("/* %c */ ", i + 32); printf ("0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", pp[i+0*256], pp[i+1*256], pp[i+2*256], pp[i+3*256], pp[i+4*256], pp[i+5*256], pp[i+6*256], pp[i+7*256]); } printf ("};\n"); CloseFont (tf); FreeRaster (pp, 256 * 8, 8); }
main(int argc, char *argv[]) { unsigned char str[256]; int i; int j; struct RastPort rp; unsigned char *pp; struct BitMap bm = { 256, /* bytes per row */ 8, /* rows */ 0, /* flags */ 1, /* depth */ 0, /* pad */ 0 /* planes */ }; struct TextAttr ta; struct TextFont *tf; struct FontRequester *fr; struct TagItem frtags[] = { ASL_Hail, (ULONG)"NetBSD font choices", ASL_Width, 640, ASL_Height, 400, ASL_LeftEdge, 10, ASL_TopEdge, 10, ASL_OKText, (ULONG)"Dump", ASL_CancelText, (ULONG)"Cancel", ASL_FontName, (ULONG)"topaz.font", ASL_FontHeight, 8L, ASL_FontStyles, FS_NORMAL, ASL_FuncFlags, FONF_STYLES | FONF_FIXEDWIDTH, TAG_DONE }; /* Let the user pick a font to dump */ if (fr = (struct FontRequester *) AllocAslRequest(ASL_FontRequest, frtags)) { if (!AslRequest(fr, NULL)) { FreeAslRequest(fr); fprintf(stderr, "User requested exit\n"); exit (0); } ta.ta_Name = (STRPTR)malloc(strlen(fr->fo_Attr.ta_Name)); strcpy(ta.ta_Name, fr->fo_Attr.ta_Name); ta.ta_YSize = fr->fo_Attr.ta_YSize; ta.ta_Style = fr->fo_Attr.ta_Style; ta.ta_Flags = fr->fo_Attr.ta_Flags; FreeAslRequest(fr); } else { fprintf(stderr, "Can't allocate Font Requestor\n"); exit (1); } /* Open the selected font */ tf = (struct TextFont *)OpenDiskFont (&ta); if (! tf) { fprintf (stderr, "Can't open font: %s\n", ta.ta_Name); exit (1); } #ifdef DEBUG fprintf(stderr, "Information on selected font:\n"); fprintf(stderr, "Name=%s\n", ta.ta_Name); fprintf(stderr, "Height=%d tf_Style=%x tf_Flags=%x Width=%d Baseline=%d\n", tf->tf_YSize, tf->tf_Style, tf->tf_Flags, tf->tf_XSize, tf->tf_Baseline); #endif /* Check for NetBSD restrictions */ if (tf->tf_Flags & FPF_PROPORTIONAL) { fprintf(stderr, "NetBSD does not support proportional fonts\n"); exit (1); } if (tf->tf_XSize > NetBSDwidth) { fprintf(stderr, "NetBSD does not support fonts wider than %d pixels\n", NetBSDwidth); exit (1); } /* Allocate area to render font in */ InitBitMap(&bm, 1, 256 * NetBSDwidth, tf->tf_YSize); InitRastPort (&rp); rp.BitMap = &bm; bm.Planes[0] = pp = AllocRaster (256 * NetBSDwidth, tf->tf_YSize); if (!pp) { fprintf (stderr, "Can't allocate raster!\n"); exit (1); } /* Initialize string to be rendered */ for (i = 32; i < 256; i++) { str[i - 32] = i; } /* Render string with selected font */ SetFont (&rp, tf); SetSoftStyle(&rp, ta.ta_Style ^ tf->tf_Style, FSF_BOLD | FSF_UNDERLINED | FSF_ITALIC); Move (&rp, 0, tf->tf_Baseline); ClearEOL(&rp); if (tf->tf_XSize != NetBSDwidth) { /* right-justify char in cell */ Move (&rp, NetBSDwidth - tf->tf_XSize, tf->tf_Baseline); /* Narrow font, put each character in space of normal font */ for (i = 0; i < (256 - 32); i++) { Text (&rp, &str[i], 1); Move (&rp, rp.cp_x + (NetBSDwidth - tf->tf_XSize), rp.cp_y); } } else { Text (&rp, str, 256 - 32); } /* Dump them.. */ printf ("/* Generated automatically by fontdumper.c. *DONT* distribute\n"); printf (" this file, it may contain information Copyright by Commodore!\n"); printf ("\n"); printf (" Font: %s/%d\n", ta.ta_Name, tf->tf_YSize); printf (" */\n\n"); printf ("unsigned char kernel_font_width = %d;\n", tf->tf_XSize); printf ("unsigned char kernel_font_height = %d;\n", tf->tf_YSize); printf ("unsigned char kernel_font_baseline = %d;\n", tf->tf_Baseline); printf ("short kernel_font_boldsmear = %d;\n", tf->tf_BoldSmear); printf ("unsigned char kernel_font_lo = 32;\n"); printf ("unsigned char kernel_font_hi = 255;\n\n"); printf ("unsigned char kernel_cursor[] = {\n"); for (j = 0; j < (tf->tf_YSize -1); j++) { printf ("0xff, "); } printf ("0xff };\n\n"); printf ("unsigned char kernel_font[] = {\n"); for (i = 0; i < 256 - 32; i++) { printf ("/* %c */", i + 32); for (j = 0; j < tf->tf_YSize; j++) { printf (" 0x%02x,", pp[i+j*256]); } printf ("\n"); } printf ("};\n"); CloseFont (tf); FreeRaster (pp, 256 * NetBSDwidth, tf->tf_YSize); return (0); }
void ami_init_mouse_pointers(void) { int i; struct RastPort mouseptr; struct DiskObject *dobj; uint32 format = IDFMT_BITMAPPED; int32 mousexpt=0,mouseypt=0; InitRastPort(&mouseptr); for(i=0;i<=AMI_LASTPOINTER;i++) { BPTR ptrfile = 0; mouseptrbm[i] = NULL; mouseptrobj[i] = NULL; char ptrfname[1024]; #ifdef __amigaos4__ if(nsoption_bool(truecolour_mouse_pointers)) { ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false); if(dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE)) { if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE)) { if(IDFMT_DIRECTMAPPED == format) { int32 width = 0, height = 0; uint8* data = 0; IconControl(dobj, ICONCTRLA_GetWidth, &width, ICONCTRLA_GetHeight, &height, ICONCTRLA_GetImageData1, &data, TAG_DONE); if (width > 0 && width <= 64 && height > 0 && height <= 64 && data) { STRPTR tooltype; if(tooltype = FindToolType(dobj->do_ToolTypes, "XOFFSET")) mousexpt = atoi(tooltype); if(tooltype = FindToolType(dobj->do_ToolTypes, "YOFFSET")) mouseypt = atoi(tooltype); if (mousexpt < 0 || mousexpt >= width) mousexpt = 0; if (mouseypt < 0 || mouseypt >= height) mouseypt = 0; static uint8 dummyPlane[64 * 64 / 8]; static struct BitMap dummyBitMap = { 64 / 8, 64, 0, 2, 0, { dummyPlane, dummyPlane, 0, 0, 0, 0, 0, 0 }, }; mouseptrobj[i] = NewObject(NULL, "pointerclass", POINTERA_BitMap, &dummyBitMap, POINTERA_XOffset, -mousexpt, POINTERA_YOffset, -mouseypt, POINTERA_WordWidth, (width + 15) / 16, POINTERA_XResolution, POINTERXRESN_SCREENRES, POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT, POINTERA_ImageData, data, POINTERA_Width, width, POINTERA_Height, height, TAG_DONE); } } } } } #endif if(!mouseptrobj[i]) { ami_get_theme_filename(ptrfname,ptrs[i], false); if(ptrfile = Open(ptrfname,MODE_OLDFILE)) { int mx,my; UBYTE *pprefsbuf = AllocVec(1061,MEMF_PRIVATE | MEMF_CLEAR); Read(ptrfile,pprefsbuf,1061); mouseptrbm[i]=AllocVec(sizeof(struct BitMap),MEMF_PRIVATE | MEMF_CLEAR); InitBitMap(mouseptrbm[i],2,32,32); mouseptrbm[i]->Planes[0] = AllocRaster(32,32); mouseptrbm[i]->Planes[1] = AllocRaster(32,32); mouseptr.BitMap = mouseptrbm[i]; for(my=0;my<32;my++) { for(mx=0;mx<32;mx++) { SetAPen(&mouseptr,pprefsbuf[(my*(33))+mx]-'0'); WritePixel(&mouseptr,mx,my); } } mousexpt = ((pprefsbuf[1056]-'0')*10)+(pprefsbuf[1057]-'0'); mouseypt = ((pprefsbuf[1059]-'0')*10)+(pprefsbuf[1060]-'0'); mouseptrobj[i] = NewObject(NULL,"pointerclass", POINTERA_BitMap,mouseptrbm[i], POINTERA_WordWidth,2, POINTERA_XOffset,-mousexpt, POINTERA_YOffset,-mouseypt, POINTERA_XResolution,POINTERXRESN_SCREENRES, POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT, TAG_DONE); FreeVec(pprefsbuf); Close(ptrfile); } } } // for }