Display jpeg image only use GTK instead of using imlib and gdk-pixbuf?



Hi there,

I would like to display jpeg images using pure gtk instead of using imlib or gdk-pixbuf, 
because I want to keep my code as small as possible.
As I know that imlib is quite big, and gdk-pixbuf contains gnome both of 
which I intend not to use them.

I have done that using GTK to display RGB images, but have not idea on how show jpeg images using GTK.
Does anyone know that is pure GTK is able to do that?

Thanks!

David

















-----Original Message-----
From: gtk-list-admin gnome org [mailto:gtk-list-admin gnome org]
Sent: Friday, January 12, 2001 1:05 AM
To: gtk-list gnome org
Subject: gtk-list digest, Vol 1 #308 - 11 msgs



Send gtk-list mailing list submissions to
     gtk-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
     http://mail.gnome.org/mailman/listinfo/gtk-list
or, via email, send a message with subject or body 'help' to
     gtk-list-request gnome org

You can reach the person managing the list at
     gtk-list-admin gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtk-list digest..."


Today's Topics:

  1. Re: [Fwd: GTK+ without X] (Thomas Haeberli)
  2. Display helloworld in Chinese? (Jin Chen)
  3. Re: GTK tooltips theming fixed? (Owen Taylor)
  4. Re: [Fwd: GTK+ without X] (Havoc Pennington)
  5. Re: GTK tooltips theming fixed? (Neil Bird)
  6. Theme/Style support in an unknown environment... (John Schmerge)
  7. Re: Pixmap question (Colin Thomas)
  8. Confused about canvas size and gtk without X (Billy Patton)
  9. Re: Pixmap question (John Cupitt)
  10. GdkCursor reset (Dugas, Alan)
  11. Re: GdkCursor reset (Mark Leisher)

--__--__--

Message: 1
From: Thomas Haeberli <ranma gargoyles ch>
Reply-To: ranma gargoyles ch
Date: Wed, 10 Jan 2001 23:08:35 +0100
charset="us-ascii"
Cc: Eric Bustarret <eric bustarret trium-rd com>, gtk-list redhat com
To: gtk-list redhat com
Subject: Re: [Fwd: GTK+ without X]

Am Montag,  8. Januar 2001 20.04 schrieben Sie:
> Hi all,
>
>   I have a couple of very nasty questions for people out there...
>
> 1. Does anybody out there know if it is possible to compile glib & gtk+
> using a c++ compiler?
>
> 2. If the above cannot be done, does anybody have any experience w/
> integrating c++ code that uses the language's exception handling
> capabilities w/ gtk+ -- I am starting to run into nasty problems of hav=
ing
> a program core dump whenever an exception is thrown from a c++ code
> fragment that is called from the gtk mainloop...


There's a Toolbox called wxWindows.
It's a very usefull Toolbox, sometimes  easyer then GTK+ himself ;)

go  to http://www.wxwindows.org and then you can download
the wxGTK+.

And some of the default Dialogs are replaced throug the Style from
the Windows Platform.

--=20
so long
Ranma-kun

http://ranma.gargoyles.ch
http://anime.gargoyles.ch
http://www.gargoyles.ch


--__--__--

Message: 2
Date: Tue, 09 Jan 2001 11:56:04 -0800
From: Jin Chen <jinc companionlink com>
Organization: CompanionLink
To: gtk-list gnome org, gtk-app-devel-list gnome org,
gtk-i18n-list gnome org
Subject: Display helloworld in Chinese?
boundary="------------E950F12A9CF14077415C6746"

This is a multi-part message in MIME format.
--------------E950F12A9CF14077415C6746
Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit



--------------E950F12A9CF14077415C6746
Content-Type: text/plain; charset=us-ascii;  name="ss"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ss"

I am learning GTK and tried to display helloworld in Chinese. I inputted
the Chinese translation on another machine and compiled on my machine.
Everything is fine except that it can't display chinese words on a button
and can't input a chinese word in a textbox

So We are installing chinese cxterm on my desktop (linux system )
in order to dispaly it in Chinese.

So we download the cxterm from
http://www.europe.redhat.com/documentation/HOWTO/Chinese-HOWTO-4.php3
and followed the instructions to install it under the account /home/jin.

The Chinese fonts(/home/jin/xfonts) and cxterm(/home/jin/bin) were
installed properly and verified.  We also added their paths like
xset fp+ /home/jin/xfonts.

But when we run CXterm, we were told :
Cannot identify a chinese font in the X Window system.

We ran xlsfonts and there is a list of corresponding fonts there.
We don't know what's the problem? We would like to hear your idead.


--------------E950F12A9CF14077415C6746--



--__--__--

Message: 3
To: GTK Mailing List <gtk-list gnome org>
Subject: Re: GTK tooltips theming fixed?
From: Owen Taylor <otaylor redhat com>
Date: 10 Jan 2001 18:10:36 -0500


Neil Bird <neil fnxweb com> writes:

>   Despite all the thmese I have 'setting' a tooltip theme, it's never
> used: the tooltip window comes up with the default GtkWindow theme,
> unadorned & hence often near invisible.
>
>   Putting 'widget "gtk-tooltips" style "default"' on the end of each
> theme's gtkrc does the job, but it seems that that shouldn't be
necessary.
> Looking in the archives, there's mention of tooltip theming becoming
> broken at some point, and it seems as if it wasn't fixed.

Tooltip theming isn't broken....

All you have to know is that tooltips aren't a special widget, they
just create a GtkWindow with a name "gtk-tooltips"

So, it's a little different from other widgets, but in not
a bug.
                                                 Owen





--__--__--

Message: 4
To: ranma gargoyles ch
Cc: gtk-list redhat com, Eric Bustarret <eric bustarret trium-rd com>
Subject: Re: [Fwd: GTK+ without X]
<y5wd7dvfk1c fsf icon labs redhat com> <01011023083501 00650 jubei>
From: Havoc Pennington <hp redhat com>
Date: 10 Jan 2001 19:36:25 -0500


Thomas Haeberli <ranma gargoyles ch> writes:
> Am Montag,  8. Januar 2001 20.04 schrieben Sie:
> > Hi all,
> >
> >   I have a couple of very nasty questions for people out there...
> >
> > 1. Does anybody out there know if it is possible to compile glib & gtk+
> > using a c++ compiler?
> >
> > 2. If the above cannot be done, does anybody have any experience w/
> > integrating c++ code that uses the language's exception handling
> > capabilities w/ gtk+ -- I am starting to run into nasty problems of
having
> > a program core dump whenever an exception is thrown from a c++ code
> > fragment that is called from the gtk mainloop...
>
>
> There's a Toolbox called wxWindows.
> It's a very usefull Toolbox, sometimes  easyer then GTK+ himself ;)
>
> go  to http://www.wxwindows.org and then you can download
> the wxGTK+.
>
> And some of the default Dialogs are replaced throug the Style from
> the Windows Platform.
>

wxGTK doesn't help at all, it still has GTK inside, so you still can't
throw exceptions when GTK signals are on the stack. wxGTK just makes
it harder to know when GTK signal emissions are on the stack, since it
conceals those as an implementation detail.

Havoc


--__--__--

Message: 5
Date: Thu, 11 Jan 2001 12:21:23 +0000
From: Neil Bird <neil fnxweb com>
Reply-To: GTK Mailing List <gtk-list gnome org>
Organization: Thales Sensors
To: GTK Mailing List <gtk-list gnome org>
Subject: Re: GTK tooltips theming fixed?

Owen Taylor wrote:
> Tooltip theming isn't broken....
>
> All you have to know is that tooltips aren't a special widget, they
> just create a GtkWindow with a name "gtk-tooltips"

  OK, fair enough. But - what is it, then (apart from the dearth of
theming documentation), that *all* of the GTK themes I've seen are doing
wrong?

  They all (pretty well) have something akin to the following:

  engine "pixmap"
  {
    ...
    image
      {
        function        = FLAT_BOX
        recolorable     = TRUE
        detail          = "tooltip"
        file            = "tooltip.png"
        border          = { 3, 3, 3, 3 }
        stretch         = TRUE
       }
     ...
   }

  ... with a tooltip.png that makes sense. I've tried changing the
'detail' field to "gtk-tooltips" but that doesn't do it.

  I have to add (assuming the theme uses a "default" style):

widget "gtk-tooltips" style "default"

  ... to the gtkrc of each theme. That then makes it work. And even then,
I'm not sure why (I cribbed it from a 1-2 year old GTK mailing-list
archive).


--
=====================- http://www.thalesgroup.com/ -=====================
Neil Bird                          |  If this .signature   |
  work mailto:neil bird rdel co uk |  looks pants, then    | $> cd /pub
  personal mailto:neil fnxweb com  |  stop using Outlook!  | $> more beer



--__--__--

Message: 6
Date: Thu, 11 Jan 2001 08:21:02 -0500
From: John Schmerge <schmerge cyber com>
To: gtk-app-devel-list gnome org
Cc: gtk-list gnome org
Subject: Theme/Style support in an unknown environment...

Hi all,

  I'm developing an application that will be installed in an environment
that
does not allow the gtk/theme config files to be installed in the standard
locations (nor would it be useful to do so).

  What I am trying to figure out is how to set up my application's look &
feel
w/o relying on any external config files (i.e. compile the rcfile
information
into the binary). Specifically, what I need to accomplish is the setting of
colors on certain widgets. As of now, what I am doing is the following:

int main(int, char **)
{
...
        gtk_rc_parse_string(
          "style \"MW\"\n"
          "{\n"
          " bg[NORMAL] = {1.0, 1.0, 1.0}\n"
          "}\n"
          "style \"MB\"\n"
          "{\n"
          " bg[NORMAL] = {0.5765, 0.5765, 1.0}\n"
          " bg[PRELIGHT] = {0.65, 0.65, 1.0}\n"
          " bg[ACTIVE] = {0.4000, 0.4000, 0.9}\n"
          "}\n"
          "style \"clear\"\n"
          "{\n"
          " bg_pixmap[NORMAL] = \"<parent>\"\n"
          "}\n"
          "widget \"main window\" style \"MW\"\n"
          "widget \"main window*GtkButton*\" style \"MB\"\n"
          "widget_class \"*EventBox*\" style \"clear\"");
...
}

Is there a more elegant way of doing this?

Also, I'd like to change the background color of the tooltips that I have
to
something other than the default drab grey.

Any information would be appreciated, since the api reference is severely
lacking in information on styles & themes.

-JS

---------------------------
John Schmerge
schmerge cyber com


--__--__--

Message: 7
Date: Thu, 11 Jan 2001 13:44:49 +0000 (GMT)
From: Colin Thomas <colin designresources co uk>
Reply-To: Colin Thomas <colin designresources co uk>
Subject: Re: Pixmap question
To: gtk-list gnome org

Hi ,

I have gone some hunting around, and have found a reference to the
following
in gdktypes.h:

############################################
/* GC function types.
 *   Copy: Overwrites destination pixels with the source pixels.
 *   Invert: Inverts the destination pixels.
 *   Xor: Xor's the destination pixels with the source pixels.
 *   Clear: set pixels to 0
 *   And: source AND destination
 *   And Reverse: source AND (NOT destination)
 *   And Invert: (NOT source) AND destination
 *   Noop: destination
 *   Or: source OR destination
 *   Nor: (NOT source) AND (NOT destination)
 *   Equiv: (NOT source) XOR destination
 *   Xor Reverse: source OR (NOT destination)
 *   Copy Inverted: NOT source
 *   Xor Inverted: (NOT source) OR destination
 *   Nand: (NOT source) OR (NOT destination)
 *   Set: set pixels to 1
 */
typedef enum
{
  GDK_COPY,
  GDK_INVERT,
  GDK_XOR,
  GDK_CLEAR,
  GDK_AND,
  GDK_AND_REVERSE,
  GDK_AND_INVERT,
  GDK_NOOP,
  GDK_OR,
  GDK_EQUIV,
  GDK_OR_REVERSE,
  GDK_COPY_INVERT,
  GDK_OR_INVERT,
  GDK_NAND,
  GDK_SET
} GdkFunction;
############################################

If I read it correctly, it seems you can overlay pixels on existing pixels
ANDing the colour ? (Which is what I am after...)

Is this the correct way it was intended? If so has anyone used the above,
and how in gtk+ ?

I also would like to have dashed lines in rectangles et al. There seems to
be the following, but again can it be used in gdk: I assume somehow it is
called in the GC which the rectangle is drawn in ?? (Either of my 2 gtk+
books
go into this depth)

############################################
typedef enum
{
  GDK_LINE_SOLID,
  GDK_LINE_ON_OFF_DASH,
  GDK_LINE_DOUBLE_DASH
} GdkLineStyle;
############################################


Many thanks in advance...

Colin Thomas
------------- Begin Forwarded Message -------------

Date: Tue, 09 Jan 2001 11:49:54 -0800
From: "Timothy M. Shead" <tshead k-3d com>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20001115
X-Accept-Language: en
MIME-Version: 1.0
To: Paul Barton-Davis <pbd Op Net>
Cc: Colin Thomas <colin designresources co uk>, gtk-list gnome org
Subject: Re: Pixmap question
Content-Transfer-Encoding: 7bit

Paul Barton-Davis wrote:

>> I need to develop Display window which can a number of coloured layers.
>> ( the various layers used in IC design).
>>
>> Where each layer overlaps another, I want to see the correct ANDING of
>> the colours.
>>
>> I need to be able to repaint with an odd layer removed from display.
>>
>> I can see that if I have multiple pixmaps (one for each layer to be
>> displayed), but just sending the desired pixmaps to the screen I should
>> be able to achieve this.
>
>
> 1) I believe that no part of X (or GDK) current supports such
>    things. This generally goes by the name "alpha channel", and X
>    doesn't support it. A pixel in a Drawable is either completely
>    transparent or completely opaque (with its own particular color).
>

The X Render extension should support these types of operations (with
hardware support, when available). However, you're talking about
bleeding edge (it only just appeared in XFree86 4.0.2) X calls - no
support from GTK+, etc. Check out the release notes and link at
http://www.xfree86.org

Regards,
Tim

------------- End Forwarded Message -------------


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Colin Thomas.
| Design Consultant.
|
| Email   : colin designresources co uk
| Tele    : (44) 1234 240562
| Fax     : (44) 1234 241262
|
| Address : Design Resources,
|           27 Market Place,
|           Olney,
|           Buckinghamshire,
|           United Kingdom.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



--__--__--

Message: 8
Date: Thu, 11 Jan 2001 08:07:18 -0600
From: Billy Patton <bpatton dal asp ti com>
Organization: Texas Instruments, Inc.
To: gtk <gtk-list gnome org>
Subject: Confused about canvas size and gtk without X

I'm trying to display some rectangles on a canvas (done) and
track the cursor by displaying it on the status bar.  WHen my
screen gets configured I set the canvas width and height

gint configure_event( GtkWidget *widget
                     ,GdkEventConfigure *event )
{
  if (pixmap) gdk_pixmap_unref(pixmap); 
  canvas_x        = widget->allocation.width;
  canvas_y        = widget->allocation.height;

The is what I thought I needed to give me a size of the canvas
so that I may scale my data correctly.  What happens is that my data
is alwasy larger than the canvas (currently testing only 2 rectangles)
and my mouse tracking changes with the size of my canvas.  At default
tracking appears to be normal, when maximized tracking is WAY off.

What could be the problem ???

Also I've been unable to find much explanation of just what gtk without
x
is.  It appears to work well on my winder98 box and I suppose that it is
meant to access the linux graphics (directX ???).  Will
something/doesitexist
for a SUN sloaris box or will we SUN users be SOL and have to continue
hitting
out X server to draw thousands of rectangles ?

--
=========+=========+=========+=========+=========+=========+=========+
   ___  _ ____       ___       __  __
  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
 / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
           /___/
Texas Instruments ASIC Circuit Design Methology Group
Dallas, Texas
214-480-4455
bpatton dal asp ti com
=========+=========+=========+=========+=========+=========+=========+


--__--__--

Message: 9
Date: Thu, 11 Jan 2001 15:43:03 +0000
From: John Cupitt <john cupitt ng-london org uk>
Organization: The National Gallery
To: Colin Thomas <colin designresources co uk>
Cc: gtk-list gnome org
Subject: Re: Pixmap question

Colin Thomas wrote:
> If I read it correctly, it seems you can overlay pixels on existing
pixels
> ANDing the colour ? (Which is what I am after...)

Hiya, you can use this ... you'd have to:

- have an off-screen pixmap on the server for each layer in your view
- on redraw (eg. on layer delete), AND all your layers together to make
another off-screen pixmap
- repaint the window by blitting from your combined view to the screen

This is going to be rather slow, and will eat up memory inside the
server. For example, on a scroll, you'll have to ship a whole new set of
pixmaps over to the server.

I think a better technique is to do this in your application. Do the AND
yourself to a big array, then paint the window with gdkrgb. Less network
traffic (maybe), less memory use (certainly).

> I also would like to have dashed lines in rectangles et al. There seems
to
> be the following, but again can it be used in gdk: I assume somehow it is
> called in the GC which the rectangle is drawn in ?? (Either of my 2 gtk+
books
> go into this depth)
>
> ############################################
> typedef enum
> {
>   GDK_LINE_SOLID,
>   GDK_LINE_ON_OFF_DASH,
>   GDK_LINE_DOUBLE_DASH
> } GdkLineStyle;
> ############################################

The best place to look is a book on xlib programming - the gdk calls are
almost identical.

HTH, John
--
John Cupitt, john cupitt ng-london org uk, +44 (0)20 7747 2570
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN


--__--__--

Message: 10
From: "Dugas, Alan" <alan dugas analog com>
To: gtk-app-devel-list gnome org, gtk-list gnome org
Subject: GdkCursor reset
Date: Thu, 11 Jan 2001 11:01:28 -0500

Does anyone know how to reset a widget's cursor to the "default cursor"
after changing it to say to a GDK_WATCH?



                    -- Stupid Genius


--__--__--

Message: 11
From: Mark Leisher <mleisher crl nmsu edu>
Date: Thu, 11 Jan 2001 09:03:42 -0700 (MST)
To: "Dugas, Alan" <alan dugas analog com>
Cc: gtk-app-devel-list gnome org, gtk-list gnome org
Subject: Re: GdkCursor reset


    Alan> Does anyone know how to reset a widget's cursor to the "default
    Alan> cursor" after changing it to say to a GDK_WATCH?

Yes.  gdk_window_set_cursor(window, 0);
-----------------------------------------------------------------------------

Mark Leisher
Computing Research Lab            Cinema, radio, television, magazines are
a
New Mexico State University       school of inattention: people look
without
Box 30001, Dept. 3CRL             seeing, listen without hearing.
Las Cruces, NM  88003                            -- Robert Bresson



--__--__--

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


End of gtk-list Digest_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]