eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'XBMReader':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: XBMReader


Inheritance:

   Object
   |
   +--ImageReader
      |
      +--XBMReader

Package:
stx:libview2
Category:
Graphics-Images-Readers
Version:
rev: 1.58 date: 2018/06/03 07:27:31
user: cg
file: XBMReader.st directory: libview2
module: stx stc-classLibrary: libview2
Author:
Claus Gittinger

Description:


this class provides methods for loading and saving x-bitmap-file images.
These images can (for example) be created using the bitmap editor supplied
with X. 
Only monochrome images can be represented in this format.
Both reading and writing of images is supported.


Related information:

    Image
    Form
    Icon
    BlitImageReader
    FaceReader
    GIFReader
    JPEGReader
    MacOSXIconReader
    PBMReader
    PCXReader
    PNGReader
    ST80FormReader
    SunRasterReader
    TargaReader
    TIFFReader
    WindowsIconReader
    XPMReader
    XWDReader

Class protocol:

initialization
o  initialize
tell Image-class, that a new fileReader is present
for the '.xbm' extension.

testing
o  canRepresent: anImage
return true, if anImage can be represented in my file format

o  isValidImageFile: aFileName
return true, if aFileName contains an x-bitmap-file image


Instance protocol:

private-reading
o  extractValueFor: keyword fromLine: lineString

reading
o  fromStream: aStream
read an image in xbm format from aStream.
Leave image description in instance variables.
(i.e. to get the image, ask with image).

writing
o  save: image onStream: aStream
save image as XBM cdata on aStream.
Only depth1 b&w images can be represented in this format.

usage example(s):

     XBMReader save:(Image fromFile:'../../goodies/bitmaps/xbmBitmaps/TicTacToe.xbm') onStream:Transcript


Examples:


Reading from a file:
  |image|

  image := Image fromFile:('../../goodies/bitmaps/xbmBitmaps/TicTacToe.xbm').
  image inspect
Saving to a file:
  |image|

  image := Image fromScreen:(0@0 corner:30@30).
  image := image asThresholdMonochromeImage.
  XBMReader save:image onFile:'/tmp/test.xbm'.
  '/tmp/test.xbm' asFilename contents asString inspect.
  (Image fromFile:('/tmp/test.xbm')) inspect.
Or directly into a stream:
  |image stream|

  image := Image fromScreen:(0@0 corner:30@30).
  image := image asThresholdMonochromeImage.
  stream := WriteStream on:(String new).
  XPMReader save:image onStream:stream.
  stream contents inspect.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 14:31:46 GMT