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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b17b79e9bf0269ea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-19 15:51:03 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news2.telebyte.nl!teleglobe.net!teleglobe.net!62.81.31.29.MISMATCH!cyclone.auna.com!twister.auna.com!53ab2750!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: Re: BMP/JPG/GIF library in Ada? Message-ID: References: X-Newsreader: MicroPlanet Gravity v2.50 Date: Fri, 20 Feb 2004 00:50:12 +0100 NNTP-Posting-Host: 212.97.171.15 X-Trace: twister.auna.com 1077234642 212.97.171.15 (Fri, 20 Feb 2004 00:50:42 MET) NNTP-Posting-Date: Fri, 20 Feb 2004 00:50:42 MET Organization: AUNA TLC Xref: archiver1.google.com comp.lang.ada:5678 Date: 2004-02-20T00:50:12+01:00 List-Id: tmoran@acm.org dice... > >> type Triple_DIBitmap_Type (Height, Width : Claw.Int) is ... > >Similar. I've chosen a constrained representation inheriting from Controlled. > Interesting. Claw's DIBitmap types start at Root_DIBitmap_Type, which > is abstract tagged, but not Controlled. Why do you inherit from Controlled? > Is there something special you do for initialization or finalization? There's no mysterious reason, I'd say. The internal array of data is allocated in the heap so it must be freed on finalization, and cloned in adjust. I considered the unconstrained Claw approach but I kinda like this other way, and I was concerned about stack overflows for large bitmaps. Since neither of the two supposed much more work, I elected the stack-safest way. Besides, I like the possibility of having the bitmap as part of an enclosing non-limited type, and forget about constraints or having to do the heap work in that outer type. > > > procedure Create ( > > This : out Object; Width : in Positive; Height : in Positive); > Why a Create procedure instead of just a declaration (as above)? This > implies you must be using heap allocation since you don't know the > Height or Width when you declare an instance of Object, right? Exactly, as outlined above. > > > procedure Triple_DIBitmap_Type_Output ( > > Stream : access Ada.Streams.Root_Stream_Type'class; > > Item : in Triple_DIBitmap_Type); > > for Triple_DIBitmap_Type'Write use Triple_DIBitmap_Type_Write; > > function Get_stream (This : in Object) > > return Ada.Streams.Stream_element_array; > Why this instead of the 'Output mechanism plus a predefined > "new Ada.Streams.Root_Stream_Type" that marshalls into an array? Do you read my mind :)? In fact, internally I'm doing that to create the array, but preferred to hide the marshalling inside the function, and besides that eliminates the need for the caller to know the array size in advance. Since I needed the array instead of the 'Output attributes, I've exposed that function instead of writing the attributes, but obviously is a matter of a few of lines to have them too. What worries me is that even if using the heap I evade the stack overflows, when returning the array I'm doomed anyway. I wonder if c++ references aren't so crazy an idea sometimes. You may think I'm obsessed with the stack thing, but I've found that in windows, past certain stack sizes, the compiler don't obey me anymore when I want to increase it, so really there is a limitation by that side (about 4 mB or so, I'd say, but never have tested it in detail). > >Claw is Windows specific, it isn't? > Yes. Claw.Bitmaps includes calls to Windows' routines for painting etc > as well as just the data structure handling. Do you know which kind of license carries the Claw demo? Could it be used in a GPLed project? I should look at it... > If this is for web serving, I'm guessing you intend to dynamically draw > on a bmp internally, since that's simple, and then convert to gif or jpg > to transmit more reasonably sized data, right? That's it. Currently I'm using it for a local web interface, so the compression is low in the to-do list, and I'm using directly the uncompressed BMP.