Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

gigahertz205

@gigahertz205
About
Posts
23
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to compress and decompress an image using GDI+ JPEG?
    G gigahertz205

    How do i compress and decompress an image using GDI+ JPEG methods?

    C# question winforms graphics tutorial

  • Turn an array or arraylist into a text file?
    G gigahertz205

    How do i turn an array or an arraylist into a text file?

    C# question data-structures

  • Indexed images with Graphics class
    G gigahertz205

    I know that the Graphics class cannot take indexed images (I dont really know why). So I need to convert the indexed image to a color image, then convert it back to indexed image. How would I go about doing this conversion into color then back into indexed? Would there be data loss during the conversions? When i was doing it using Photoshop, every time i switched between indexed and RGB, the image got darker and darker, which meant data wasn't being preserved.

    C# graphics adobe question

  • How to save something in memory to file?
    G gigahertz205

    So I have implemented the binary tree shown here (http://msdn.microsoft.com/en-us/library/ms379572.aspx[^]). I have no prior knowledge in I/O and its related areas, so any quick reads would be nice. My question is, how would i save the tree (including the root as well as the internal and leaf nodes) into a file? How would i use the file after its saved? I have a decoder (just a simple program that traverses all of the tree's nodes and writes them out in console), but I would have no idea how to recall the file and decode it. Any help is appreciated.

    C# question com data-structures performance help

  • Lockbits error [modified]
    G gigahertz205

    The parameters are as follows: public System.Drawing.Imaging.BitmapData LockBits(System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format) And the rectangle: public Rectangle(int x, int y, int width, int height) This worked when my starting point was at (0,0) and visited every single pixel in the image, but when its at (256,0), it gives me back an error. EDIT: this is where i got the code from (http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx[^])

    C# help graphics

  • Lockbits error [modified]
    G gigahertz205

    I have a 512x512 image, and using lockbits and unsafe code, i visit each pixel to retrieve that pixel value. This is a grayscale image. What i want to do is start the retrieval from the 256th pixel in each row (or, collectively, the right half of the image). Heres what i tried:

    inputImg = Image.FromFile(inputImgPath);
    b = (Bitmap)inputImg;
    BitmapData bmData = b.LockBits(new Rectangle(256, 0, b.Width, b.Height),
    ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
    int stride = bmData.Stride;
    System.IntPtr Scan0 = bmData.Scan0;
    unsafe
    {
    byte* p = (byte*)(void*)Scan0;
    int nOffset = stride - 256;
    for (int y = 0; y < b.Height; ++y)
    {
    for (int x = 0; x < 256; ++x)
    {
    current = (byte)p[0];
    p++;
    }
    p += nOffset;
    }
    }
    b.UnlockBits(bmData);

    The problem is occurs when i use the LockBits method. The compiler says the parameter is not valid.

    modified on Saturday, August 23, 2008 12:33 AM

    C# help graphics

  • Change values of pixels in an area?
    G gigahertz205

    I set a specific value of intensity (for greyscale) or color within that region so fillrectangle is out of the question. So i guess unsafe is the way to go. As far as DirectX goes, I have no idea how to set it up. To answer the question above, an "area" is considered a portion of an image. Hence an area or region.

    C# question

  • Change values of pixels in an area?
    G gigahertz205

    How would i go about changing values in pixels in an area? Note, all pixels will have the same value. I was thinking of using unsafe code to visit every single pixel in that area, but that may be too slow if i do this multiple time.

    C# question

  • Lockbits and 8-bit grayscale images
    G gigahertz205

    Hmm it must be the website that i downloaded the image from. Im using the Lena picture in grayscale, which i previously downloaded. I downloaded the color version of lena and converted into grayscale using photoshop. Pixels return intensities properly now. Thank you.

    C# question

  • Lockbits and 8-bit grayscale images
    G gigahertz205

    if its 8-bit then shouldn't the values range from 0-255? I get black pixel as 0 and white as 169. Is this what its supposed to be?

    C# question

  • Lockbits and 8-bit grayscale images
    G gigahertz205

    I have to pass pixelformat as a parameter when performing lockbits. But for grayscale images, there is only "Format16bppGrayscale." Does this format work with 8 bit grayscale images? If not, how do i use lockbits with 8bit grayscale images?

    C# question

  • How much memory do uninitialized array take up?
    G gigahertz205

    How much memory do uninitialized arrays take up? EX: int[] numbers; Do uninitialized value types take space too?

    C# data-structures performance question

  • Point Arrangement and Orientation
    G gigahertz205

    Well if you look at my previous posts, you will get a basic idea of what im trying to do. I want to divide up an image using arbitrarily oriented lines, and use points of the polygons to edit the contents within that region. Basically, i use two points to create line segments, whose points will be added to Point arrays of that region. But then again, i as i create the line segments, i have no way to enforce which points to add first.

    C# graphics data-structures help

  • Point Arrangement and Orientation
    G gigahertz205

    Many overloads of System.Drawing.Graphics use Point array as a parameter. But I've found a puzzling problem with the Point array. The order in which the points are stored in the array creates different shape than intended. I used System.Drawing.Graphics.FillPolygon using four points and two different results came out depending on the order of points(http://img509.imageshack.us/img509/2944/boxch5.jpg[^]). Yes, i could have used the FillRectangle, but i will use figures with more than 4 sides. I want to know if there is a way to arrange the points so that they have a counterclockwise or clockwise rotation.

    C# graphics data-structures help

  • Change values of pixels
    G gigahertz205

    How do i change the value of pixels? I saw this guide (http://www.codeproject.com/KB/GDI-plus/csharpgraphicfilters11.aspx[^]). Is unsafe code the only way to modify the value of pixels? Since Im only working on grayscale images (8 bit depth), is it possible to "color" in the pixels instead of changing the value numerically?

    C# question com graphics tutorial

  • Divide an image
    G gigahertz205

    Ok few more questions: 1) How is the coordinate plane set up? Like where would the origin be? 2) could a point be outside of an image?

    C# question

  • Divide an image
    G gigahertz205

    thanks

    C# question

  • Divide an image
    G gigahertz205

    Just changing the value of the pixels. Nothing complex. So to create a region using System.Drawing.Graphics, i just use a Point array? Thanks for the responses.

    C# question

  • Divide an image
    G gigahertz205

    From what i see in System.Drawing.Region, correct me if Im wrong, I can create a region of any size and shape. System.Drawing.Rectangle uses four points to specify the size of the rectangle using four points, but i dont suppose its possible with System.Drawing.Region using three points? Im not sure if im making sense. From reading previous posts, i implied that i needed to save these two triangles separately, which meant that i need to display the divided image. However, this is not the case. I just need to divide up an image, perform some changes within those triangles and display them altogether with the changes that were made.

    C# question

  • Divide an image
    G gigahertz205

    So then if i want to create a bitmap that contains a triangle, would I create a bitmap that can enclose the triangle and fill the rest with something like null pixel value?

    C# question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups