public void PluginSelected() { RSImage image = new RSImage(Cache, Node, Data, (int)((NumericUpDown)ToolControls[1]).Value); ((PictureBox)Controls[0]).Image = image.GenerateBitmap(); if (((PictureBox)Controls[0]).Image == null) { Controls[0].Visible = false; Controls[1].Visible = true; FileExtensions = ""; } else { Controls[0].Visible = true; Controls[1].Visible = false; FileExtensions = "PNG Image (*.png)|*.png"; } }
public bool OnImport(string filename) { try { Exception e = null; RSImage new_image = new RSImage(filename, out e); if (e != null) throw e; new_image.Write(Cache, Node, Data); Data = Cache.SubArchives[Node.SubArchive].ExtractFile(Node.FileIndex); ((PictureBox)Controls[0]).Image = new_image.GenerateBitmap(); return true; } catch (Exception ex) { MessageBox.Show("Error importing image.\n\n" + ex.Message + "\n\n" + ex.StackTrace, "Error Importing Image", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
public static void LoadTextures(Cache cache) { loaded_texture_count = 0; for (int j = 0; j < 50; j++) try { textures[j] = new RSImage(cache.SubArchives[6], j); textures[j].ResizeToWhole(); //texture_cache[j] = textures[j].; //if (low_memory && textures[j].WholeWidth == 128) // textures[j].LoadHalf(); //else // textures[j].LoadFull(); loaded_texture_count++; } catch (Exception) { } }
public void PluginSelected() { RSImage image = new RSImage(Cache, Node, Data, 0); ((PictureBox)Controls[0]).Image = image.GeneratePaletteBitmap(); if (((PictureBox)Controls[0]).Image == null) { Controls[0].Visible = false; Controls[1].Visible = true; FileExtensions = ""; } else { Controls[0].Visible = true; Controls[1].Visible = false; FileExtensions = ""; } }
public static void DrawRSImage(RSImage s, int x, int y) { x += s.XOffset; y += s.YOffset; int l = x + y * DrawingArea.width; int i1 = 0; int j1 = s.Height; int k1 = s.Width; int l1 = DrawingArea.width - k1; int i2 = 0; if (y < DrawingArea.topY) { int j2 = DrawingArea.topY - y; j1 -= j2; y = DrawingArea.topY; i1 += j2 * k1; l += j2 * DrawingArea.width; } if (y + j1 > DrawingArea.bottomY) j1 -= (y + j1) - DrawingArea.bottomY; if (x < DrawingArea.topX) { int k2 = DrawingArea.topX - x; k1 -= k2; x = DrawingArea.topX; i1 += k2; l += k2; i2 += k2; l1 += k2; } if (x + k1 > DrawingArea.bottomX) { int l2 = (x + k1) - DrawingArea.bottomX; k1 -= l2; i2 += l2; l1 += l2; } if (!(k1 <= 0 || j1 <= 0)) { DrawPixels(s.Pixels, i1, l, k1, j1, l1, i2); } }