From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6d07d0186a356c56 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!gegeweb.org!aioe.org!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Representing image data Date: Wed, 11 Mar 2009 22:39:34 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: jsj6/wjO/cHSAHkcGxcp1Q.user.aioe.org X-Complaints-To: abuse@aioe.org NNTP-Posting-Date: Wed, 11 Mar 2009 22:39:34 +0000 (UTC) X-Notice: Filtered by postfilter v. 0.7.7 X-Newsreader: Tom's custom newsreader Cancel-Lock: sha1:QwGiqxb6s/ScWvouojXE+7+Vzy8= Xref: g2news1.google.com comp.lang.ada:4050 Date: 2009-03-11T22:39:34+00:00 List-Id: CLAW (which is for Windows) uses children of a root tagged type for the different pixel representations. Thus type VGA_DIBitmap_Type (Height, Width : Claw.Int) is new Basic_DIBitmap_Type (Height, Width) with record ... and type RGB555_DIBitmap_Type (Height, Width : Claw.Int) is new Basic_DIBitmap_Type (Height, Width) with record ... with appropriate procedures for Windows system calls. Writing takes a classwide parameter so it can write any format, and Read is a function returning a classwide type. If the application is always dealing with one kind - 24 bit RGB, say, then it can be written to efficiently deal with only that. If it must handle several kinds it can use the same mechanism to make a routine that efficiently does something with 24 bit RGB bitmaps, another routine if it's a 555 RGB bitmap, etc and let dispatching call the right one. So what code to use for different kinds of pixels is decided at the bitmap level, not again and again for each pixel.