Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 240359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:39:36+00:00 2026-05-11T20:39:36+00:00

using java and jna I call a fonction : trace(potrace_ bitmap_s) struct potrace_bitmap_s {

  • 0

using java and jna I call a fonction : trace(potrace_ bitmap_s)

struct potrace_bitmap_s { 
int w, h; 
int dy; /* scanline offset in words */
potrace_word *map; /* pixel data, dy*h words */
};
typedef struct potrace_bitmap_s potrace_bitmap_t;

w, h: are width and height of a bitmap

in doc of library a found this

Here, potrace_word is an unsigned
integer type defined in potracelib.h.
It is usually equal to a native
machine word (i.e., 32 bits on a
32-bit architecture). In the following
explanation, we assume that the type
potrace_word holds N bits.

A bitmap of dimensions w*h is
divided, bottom to top, into h
horizontal scanlines. Each scanline is
divided, left to right, into blocks of
N pixels. Each such block of N pixels
is stored as a single potrace_word,
with the leftmost pixels of the block
corresponding to the most significant
bit of the word, and the rightmost
pixel of the block corresponding to
the least significant bit of the word.
Pixels that are “on” (or “black” or
“foreground”) are represented by bit
value 1. Pixels that are “off” (of
“white” or “background”) are
represented by bit value 0. If the
number of bits in a scanline is not
divisible by N, then the rightmost
word of the scanline is padded on the
right with zeros. The data for
scanline 0 (the bottom-most scanline)
begins at map[0]. The data for
scanline 1 begins at map[dy]. The data
for scanline 2 begins at map[2*dy],
and so forth. Note that dy can be
either positive or negative, depending
on how an application wishes to lay
out the image data in memory.

but I not understood how I can represente in java map.

public class Potrace_bitmap_t extends Structure{
    int w, h; /* width and height, in pixels */
    int dy; /* scanline offset in words */
    map ??; /* pixel data, dy*h words */
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:39:36+00:00Added an answer on May 11, 2026 at 8:39 pm

    This is a pretty standard way of storing a 2 color image, like what you get from a fax-encoded tiff. The “map” is supposed to be an array of unsigned 32 bit integers. I don’t think Java lets you declare uint32, but it doesn’t really matter in this case, since all you care about is the bits.

    Declare “Map” as an array of integers. To make this into an image, you can examine the bits in the array one at a time. If bit 0 (I am assuming an Intel machine) of the first int in the array is a “1”, then the pixel in the lower left corner of the image should be set to black. If it is a “0”, set that pixel to white. Each int will give you 32 pixels. If the width of the image is not divisible by 32, you will need to skip ahead. This is what “map[2*dy]” is telling you.

    So, if the image width is 55 for example, you set 32 pixels with map[0], then set 23 pixels with map[1], then begin with the next line of the image (the one next to the bottom) at the first bit of map[2]. (dy for an image 55 pixels wide would be 2, assuming 32 bit integers)

    Do this in a loop, bottom of the image to the height value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 401k
  • Answers 401k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The logs your talking about can be deleted by an… May 15, 2026 at 4:30 am
  • Editorial Team
    Editorial Team added an answer returns 1 if the string (in $arrow) equals area or… May 15, 2026 at 4:30 am
  • Editorial Team
    Editorial Team added an answer DropDownList d = Your_Drop_Down_List; int i; if(int.TryParse(d.SelectedValue, out i)) {… May 15, 2026 at 4:30 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.