Module: Resedit

Defined in:
lib/resedit.rb,
lib/resedit/mz/bw.rb,
lib/resedit/mz/le.rb,
lib/resedit/mz/mz.rb,
lib/resedit/app/app.rb,
lib/resedit/font/font.rb,
lib/resedit/text/text.rb,
lib/resedit/classes/env.rb,
lib/resedit/image/image.rb,
lib/resedit/mz/multiexe.rb,
lib/resedit/text/escaper.rb,
lib/resedit/text/huffman.rb,
lib/resedit/app/mz_command.rb,
lib/resedit/classes/config.rb,
lib/resedit/convert/colors.rb,
lib/resedit/font/font_char.rb,
lib/resedit/app/app_command.rb,
lib/resedit/app/io_commands.rb,
lib/resedit/classes/exefile.rb,
lib/resedit/convert/bitconv.rb,
lib/resedit/image/png_image.rb,
lib/resedit/text/conv_table.rb,
lib/resedit/text/format_xml.rb,
lib/resedit/app/font_convert.rb,
lib/resedit/app/std_commands.rb,
lib/resedit/app/text_convert.rb,
lib/resedit/text/conv_keybru.rb,
lib/resedit/text/format_text.rb,
lib/resedit/classes/colorizer.rb,
lib/resedit/classes/hexwriter.rb,
lib/resedit/convert/bitstream.rb,
lib/resedit/convert/codepatch.rb,
lib/resedit/classes/changeable.rb,
lib/resedit/image/image_factory.rb

Defined Under Namespace

Classes: App, AppCommand, BW, BWBody, BWHeader, BitConverter, BitStream, Changeable, CodePatch, Color, ColorMap, Colorizer, Config, ConvertCommand, ConvertTable, Env, ExeBody, ExeFile, ExeHeader, ExitCommand, ExportCommand, Font, FontChar, FontConvertCommand, FormatTxt, FormatXml, HelpCommand, HexWriter, Huffman, ITextConvert, Image, ImportCommand, KeyboardRuConvertTable, LE, LEBody, LEHeader, MZ, MZBody, MZCommand, MZHeader, Multiexe, PngImage, ScriptCommand, ShellCommand, SlashEscaper, StdEscaper, TableEscaper, Text, TextConvertCommand, TextEscaper, TextFormat, VersionCommand

Constant Summary collapse

VERSION =
"1.8.6"

Class Method Summary collapse

Class Method Details

.createImage(width, height, type = Image::TYPE_PNG, format = Image::FORMAT_INDEXED) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/resedit/image/image_factory.rb', line 8

def createImage(width, height, type=Image::TYPE_PNG, format=Image::FORMAT_INDEXED)
    type = type[-3..-1] if type.length>3
    case type
    when Image::TYPE_PNG
        img = PngImage.new()
    else
        raise "Unknown format #{type}"
    end
    img.create(width, height, format)
    return img
end

.loadImage(filename) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/resedit/image/image_factory.rb', line 21

def loadImage(filename)
    ext = filename[-3..-1].downcase()
    case ext
    when Image::TYPE_PNG
        img=PngImage.new()
    else
        raise "Unknown file format #{filename}"
    end
    img.load(filename)
    return img
end