Graphics Functions

  • AdditiveBlit() Additive Blits an image onto another image.
  • AlphaBlit() Blit an image with an alpha mask
  • Blit() Draws an image onto another image, ignoring transparancy.
  • BlitEntityFrame() Blits a specified entity frame to the screen
  • BlitLucent() Simple blit with constant translucency override
  • BlitTile() Blit a tile from the vsp to the screen.
  • BlitWrap() Draws an image such that it will wrap around the boundaries of the destination.
  • Circle() Draws an unfilled circle.
  • CircleFill() Draws a filled circle.
  • ColorFilter() Applies the specified color filter to an image to tint it.
  • ColorReplace() Replaces a color in an image with another.
  • CopyImageToClipboard() Copy an image pointer from Verge into the clipboard.
  • DuplicateImage() Makes an exact, but seperate, copy of an image.
  • FlipBlit() Blits a horizontally or vertically mirrored image onto a destination image.
  • FreeImage() Frees the memory occupied by the image reference passed.
  • GetB() Returns the value of the blue channel of a color.
  • GetG() Returns the value of the green channel of a color.
  • GetH() Returns the hue of a color
  • GetImageFromClipboard() Retrieve an image pointer from the clipboard.
  • GetPixel() Returns the color from a specific pixel in the specified image.
  • GetR() Returns the value of the red channel of a color.
  • GetS() Returns the saturation of a color.
  • GetV() Returns the value/brightness of a color
  • GrabRegion() Extracts a sub-rectangle from a given image
  • HSV() Creates a color using the HSV color model.
  • HueReplace() Finds a range a range of hues within an image and replaces them with another.
  • ImageHeight() Returns the height of an image object.
  • ImageShell() Creates a duplicate image handle referencing a rectangle in the original image
  • ImageValid() Returns whether specific image pointer is valid or not.
  • ImageWidth() Returns the width of an image object.
  • Line() Draws a colored line onto an image.
  • LoadImage() Reads an image file into memory, and returns an IMAGE handle.
  • LoadImage0() Loads a paletted image and makes palette index 0 transparent.
  • LoadImage8() Loads a paletted image and makes the transparent index compatible Verge's transparency.
  • MakeColor() Returns a color in a format usable by other image functions.
  • MixColor() Mixes two colors in the given proportion
  • Mosaic() Applies a mosaic effect to an image.
  • NewImage() Creates a new image. Useful for drawing to.
  • Rect() Draws a 1-pixel thick rectangle onto an image.
  • RectFill() Draws a solid colored rectangle onto an image.
  • RectHGrad() Draws a rectangle filled with a horizontal gradient.
  • RectRGrad() Draws a rectangle filled with a radial/circular gradient
  • RectVGrad() Draws a rectangle filled with a vertical gradient
  • RGB() Returns a color in a format usable by other image functions.
  • RotScale() Rotate and/or scale an image and draws it to another image.
  • ScaleBlit() Draws an stretched image to another image.
  • SetClip() Sets the current clipping rectangle on an image object.
  • SetCustomColorFilter() Creates a custom color filter with colors in between c1 and c2.
  • SetLucent() Sets the Lucency value for all drawing functions.
  • SetPixel() Changes the color of a single pixel in the specified image.
  • ShowPage() Updates the screen with all the changes you made to it.
  • Silhouette() Draws a colored silhouette of one image onto another image.
  • SubtractiveBlit() Subtractive blits one image onto another.
  • SuperSecretThingy() Shhh... It's a secret!
  • TAdditiveBlit() A transparent-conscious version of AdditiveBlit
  • TBlit() Draws an image onto another, but lets the base image show through the transparent parts of the source.
  • TBlitLucent() Simple transparent blit with constant translucency override
  • TBlitTile() Blit a tile from the vsp with transparency
  • TGrabRegion() Extracts a sub-rectangle from a given image and blits with transparency
  • Triangle() Renders a FILLED triangle
  • TScaleBlit() A transparency-conscious version of Scaleblit.
  • TSubtractiveBlit() A transparency-conscious version of SubtractiveBlit.
  • TWrapBlit() A transparency-conscious version of WrapBlit.
  • WrapBlit() Blits a tiling pattern of an image onto another image.
  • Talkback

    Post a new comment?

    Talkback #2 written by Zip on 2004-06-12.

    int GetMaskByColour(int gmbc_col, int gmbc_image)
    
    // Creates a mask of an image, magenta background, black where specified colour is
    // Pass: the colour to create mask from; image handle
    // Return: the handle to the mask created
    // Assumes: you have global: int x, y; Rename and declare locally if you like
    {
    int gmbc_h = ImageHeight(gmbc_image); // Height of passed image
    int gmbc_w = ImageWidth(gmbc_image); // Width of passed image
    // Gets pointer to new image of same dimensions
    int gmbc_handle = NewImage(gmbc_w, gmbc_h);
    for (y = 0; y < gmbc_h; y++) // Scan through all y pixels
    {
    for (x = 0; x < gmbc_w; x++) // Scan through all x pixels
    {
    // If this pixel matches the set colour
    if (GetPixel(x, y, gmbc_image) == gmbc_col)
    {
    // Put a black pixel in the mask
    SetPixel(x, y, 0, gmbc_handle);
    }
    else // Otherwise put a magenta pixel in the mask
    {
    SetPixel(x, y, 16711935, gmbc_handle);
    }
    }
    }
    return gmbc_handle; // Return the pointer to the mask
    }


    Use if you frequently need to change a colour in an image. The function itself is slow, but it only needs to be called once per image, per colour. Whenever you need a different colour, Blit() the original image, then Silhouette() the mask over it with whatever colour you desire.

    Example: Add in the code above and the Wait() code, and put the image in the same directory
    int x, y;
    

    void autoexec()
    {
    int r,g,b; // To store colour values
    int vimg = LoadImage("v3.gif"); // Loads image of v3 logo
    // Creates mask of white values
    int vmask = GetMaskByColour(RGB(255,255,255), vimg);
    while (!b3) // If espace is not pressed
    {
    r += 1; // Cycle through red values...
    g += 2; // ...and green...
    b += 4; // ...and blue
    Blit(0, 0, vimg, screen); // Puts the image in the screen buffer
    // Blits coloured mask over the top
    Silhouette(0, 0, RGB(r,g,b), vmask, screen);
    ShowPage(); // Displays the buffer on the screen
    Wait(5); // Wait 5 timer ticks
    }
    FreeImage(vimg); // Remove image from memory
    FreeImage(vmask); // Ditto
    exit("Bye!");
    }

    Talkback #1 written by Zip on 2004-06-12.

    void SwapColours(int sc_col_out, int sc_col_in, int sc_image)
    
    // Changes all of one colour value in an image to another colour
    // Pass: the colour to replace; the colour to insert; image handle
    // Assumes: you have global: int x, y; Rename and declare locally if you like
    {
    int sc_h = ImageHeight(sc_image); // Height of passed image
    int sc_w = ImageWidth(sc_image); // Width of passed image
    for (y = 0; y < sc_h; y++) // Scan through all y pixels
    {
    for (x = 0; x < sc_w; x++) // Scan through all x pixels
    {
    // If this pixel matches the old colour
    if (GetPixel(x, y, sc_image) == sc_col_out)
    // Set the pixel to the new colour
    SetPixel(x, y, sc_col_in, sc_image);
    }
    }
    }

    Use for infrequent changing of one colour. As this is a slow function (and increasingly so with larger images) you only want to be calling it when you need to. To deal with more frequent changes use GetMaskByColour() and blit the mask as a silhouette over the original image.

    Example: Add in the code above, and put the image in the same directory
    int x, y;
    

    void autoexec()
    {
    int test = LoadImage("v3.gif"); // Loads image of v3 logo
    Blit(0, 0, test, screen); // Puts the image in the screen buffer
    SwapColours(RGB(255,255,255), RGB(0,255,0), test); // Change white to green
    Blit(100, 0, test, screen); // Puts image on screen with all white now green
    ShowPage(); // Displays the buffer on the screen
    FreeImage(test); // Remove image from memory
    while (!b3) // If espace is not pressed
    {
    UpdateControls(); // Check inputs
    }
    exit("Bye!");
    }

    Post a new comment?

    Ben McGraw's lovingly crafted this website from scratch for years.
    It's a lot prettier this go around because of Jon Wofford.
    Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.