comp.lang.ada
 help / color / mirror / Atom feed
* BMP/JPG/GIF library in Ada?
@ 2004-02-16 20:40 Brian Catlin
  2004-02-16 21:32 ` Randy Brukardt
  2004-02-16 22:59 ` Gautier Write-only
  0 siblings, 2 replies; 11+ messages in thread
From: Brian Catlin @ 2004-02-16 20:40 UTC (permalink / raw)


Does anyone have a library for reading, writing and manipulating image files in
the BMP, JPG, or GIF format?  I tried searching on AdaPower, but the search
capability doesn't work (nor do a lot of the links)

 -Brian





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-16 20:40 BMP/JPG/GIF library in Ada? Brian Catlin
@ 2004-02-16 21:32 ` Randy Brukardt
  2004-02-16 22:59 ` Gautier Write-only
  1 sibling, 0 replies; 11+ messages in thread
From: Randy Brukardt @ 2004-02-16 21:32 UTC (permalink / raw)


"Brian Catlin" <BrianC@sannas.org.bad> wrote in message
news:WU9Yb.6245$tL3.4703@newsread1.news.pas.earthlink.net...
> Does anyone have a library for reading, writing and manipulating image
files in
> the BMP, JPG, or GIF format?  I tried searching on AdaPower, but the
search
> capability doesn't work (nor do a lot of the links)

I don't have a specific answer to your question (other than that Claw has
routines for reading/writing BMPs - but of course that's specific to
Windows). But you ought to try the Ada-wide search engine on adaic.com
(http://www.adaic.com/site/wide-search.html). It searches all of the sites
that we know of that contain Ada-related information.

                    Randy Brukardt
                    Technical Webmaster, adaic.com







^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-16 20:40 BMP/JPG/GIF library in Ada? Brian Catlin
  2004-02-16 21:32 ` Randy Brukardt
@ 2004-02-16 22:59 ` Gautier Write-only
  2004-02-17 17:53   ` Brian Catlin
  1 sibling, 1 reply; 11+ messages in thread
From: Gautier Write-only @ 2004-02-16 22:59 UTC (permalink / raw)


Brian Catlin:

# Does anyone have a library for reading, writing and manipulating image files in
# the BMP, JPG, or GIF format?  I tried searching on AdaPower, but the search
# capability doesn't work (nor do a lot of the links)

There are BMP (I/O) and GIF (I) in SVGA.IO in dos_paqs.zip, URL at bottom.
Full Ada, easy to adapt to another contex as SVGA & DOS.

BTW, for PNG there is:
  http://privatewww.essex.ac.uk/~sjs/png_io/png_io.html

HTH
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-16 22:59 ` Gautier Write-only
@ 2004-02-17 17:53   ` Brian Catlin
  2004-02-18 19:09     ` Jano
  0 siblings, 1 reply; 11+ messages in thread
From: Brian Catlin @ 2004-02-17 17:53 UTC (permalink / raw)


"Gautier Write-only" <gautier@fakeaddress.nil> wrote in message
news:40314B5E.62F773F5@fakeaddress.nil...
> Brian Catlin:
>
> # Does anyone have a library for reading, writing and manipulating image files
in
> # the BMP, JPG, or GIF format?  I tried searching on AdaPower, but the search
> # capability doesn't work (nor do a lot of the links)
>
> There are BMP (I/O) and GIF (I) in SVGA.IO in dos_paqs.zip, URL at bottom.
> Full Ada, easy to adapt to another contex as SVGA & DOS.
>
> BTW, for PNG there is:
>   http://privatewww.essex.ac.uk/~sjs/png_io/png_io.html

Great!  Thanks

 -Brian





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-17 17:53   ` Brian Catlin
@ 2004-02-18 19:09     ` Jano
  2004-02-18 20:20       ` tmoran
  0 siblings, 1 reply; 11+ messages in thread
From: Jano @ 2004-02-18 19:09 UTC (permalink / raw)


Brian Catlin dice...
> "Gautier Write-only" <gautier@fakeaddress.nil> wrote in message
> news:40314B5E.62F773F5@fakeaddress.nil...
> > Brian Catlin:
> >
> > # Does anyone have a library for reading, writing and manipulating image files
> in
> > # the BMP, JPG, or GIF format?  I tried searching on AdaPower, but the search
> > # capability doesn't work (nor do a lot of the links)
> >
> > There are BMP (I/O) and GIF (I) in SVGA.IO in dos_paqs.zip, URL at bottom.
> > Full Ada, easy to adapt to another contex as SVGA & DOS.
> >
> > BTW, for PNG there is:
> >   http://privatewww.essex.ac.uk/~sjs/png_io/png_io.html
> 
> Great!  Thanks

I'm working in a simple package which allows to trivially create an in-
memory 24bpp uncompressed BMP and convert it to a Stream_Element_Array. 
The idea is to easily generate some graphs/plots with AWS. It already 
transform the BMP and allows plotting of individual pixels. I'm thinking 
of adding line and circle/ellipse functions, for example. LZH 
compression could come too at a later stage.

If anyone is interested I can send it to him, I'll not publish it for 
the moment (it's part of another project which is own release schedule).



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-18 19:09     ` Jano
@ 2004-02-18 20:20       ` tmoran
  2004-02-19 18:48         ` Jano
  0 siblings, 1 reply; 11+ messages in thread
From: tmoran @ 2004-02-18 20:20 UTC (permalink / raw)


>I'm working in a simple package which allows to trivially create an in-
>memory 24bpp uncompressed BMP and convert it to a Stream_Element_Array.
  Like this, or different?
    type Triple_DIBitmap_Type (Height, Width : Claw.Int) is ...

    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;



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-18 20:20       ` tmoran
@ 2004-02-19 18:48         ` Jano
  2004-02-19 19:43           ` tmoran
  0 siblings, 1 reply; 11+ messages in thread
From: Jano @ 2004-02-19 18:48 UTC (permalink / raw)


tmoran@acm.org dice...
> >I'm working in a simple package which allows to trivially create an in-
> >memory 24bpp uncompressed BMP and convert it to a Stream_Element_Array.
>   Like this, or different?
>     type Triple_DIBitmap_Type (Height, Width : Claw.Int) is ...
> 
>     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;

Similar. I've chosen a constrained representation inheriting from 
Controlled. Besides I wanted to use the Build function of AWS which 
takes an array, so I have a function which returns the 
Stream_Element_Array with the data.

------------------------------------------------------------------------
-- Create                                                             --
------------------------------------------------------------------------
   procedure Create (
      This : out Object; Width : in Positive; Height : in Positive);

------------------------------------------------------------------------
-- Get_stream                                                         --
------------------------------------------------------------------------
-- Returns a valid BMP representation (not the pixel matrix).
   function Get_stream (This : in Object) 
      return Ada.Streams.Stream_element_array;

The function I'm using from AWS is

function Build
     (Content_Type  : in String;
      Message_Body  : in Streams.Stream_Element_Array;
      Status_Code   : in Messages.Status_Code         := Messages.S200;
      Cache_Control : in Messages.Cache_Option        := 
Messages.Unspecified)
      return Data;

Claw is Windows specific, it isn't?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-19 18:48         ` Jano
@ 2004-02-19 19:43           ` tmoran
  2004-02-19 23:50             ` Jano
  0 siblings, 1 reply; 11+ messages in thread
From: tmoran @ 2004-02-19 19:43 UTC (permalink / raw)


>>     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?

>  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?

>     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?

>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.

  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?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-19 19:43           ` tmoran
@ 2004-02-19 23:50             ` Jano
  2004-02-20 20:20               ` Randy Brukardt
  0 siblings, 1 reply; 11+ messages in thread
From: Jano @ 2004-02-19 23:50 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-19 23:50             ` Jano
@ 2004-02-20 20:20               ` Randy Brukardt
  2004-02-20 21:10                 ` Jeff C,
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Brukardt @ 2004-02-20 20:20 UTC (permalink / raw)


"Jano" <nono@unizar.es> wrote in message
news:MPG.1a9f6a1dad6a8ac39896c0@news.able.es...
> tmoran@acm.org dice...
> Do you know which kind of license carries the Claw demo? Could it be
> used in a GPLed project? I should look at it...

The Claw Intro edition is licensed under the GMGPL. But, unfortunately, you
won't find that on the web site or in the files; that's been waiting for the
next release of the Intro version. (It was announced here and repeated a
number of times.)

                  Randy.






^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: BMP/JPG/GIF library in Ada?
  2004-02-20 20:20               ` Randy Brukardt
@ 2004-02-20 21:10                 ` Jeff C,
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff C, @ 2004-02-20 21:10 UTC (permalink / raw)



"Randy Brukardt" <randy@rrsoftware.com> wrote in message
news:103cr2mb4jccb5a@corp.supernews.com...
> "Jano" <nono@unizar.es> wrote in message
> news:MPG.1a9f6a1dad6a8ac39896c0@news.able.es...
> > tmoran@acm.org dice...
> > Do you know which kind of license carries the Claw demo? Could it be
> > used in a GPLed project? I should look at it...
>
> The Claw Intro edition is licensed under the GMGPL. But, unfortunately,
you
> won't find that on the web site or in the files; that's been waiting for
the
> next release of the Intro version. (It was announced here and repeated a
> number of times.)
>

There is some mention of this at http://www.adapower.com/claw including
links to the original
announcement. Would be nice if the vendor indicated it locally though.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-02-20 21:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-16 20:40 BMP/JPG/GIF library in Ada? Brian Catlin
2004-02-16 21:32 ` Randy Brukardt
2004-02-16 22:59 ` Gautier Write-only
2004-02-17 17:53   ` Brian Catlin
2004-02-18 19:09     ` Jano
2004-02-18 20:20       ` tmoran
2004-02-19 18:48         ` Jano
2004-02-19 19:43           ` tmoran
2004-02-19 23:50             ` Jano
2004-02-20 20:20               ` Randy Brukardt
2004-02-20 21:10                 ` Jeff C,

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox