Index


Creating thumbnail graphics


The following function will convert an image to a thumbnail graphic surrounded by a black frame. If the image is wider than it is high, the image will be framed with an even black border along the top and bottom edges and if it is higher than it is wide the image will be framed with an even border along the left and right edges. The function assumes two global variables, a bitmap which will become the thumbnail (the variable name 'bitmap' below) and a global trect variable (named 'rect' below) which determines the size of the thumbnail to create ... for example to create a thumbnail of size 64 by 64 rect.bottom would be set to 64, rect.right would be set to 64, with both rect.top and rect.left set to 0.

The larger bitmap (in the 'bitmap' variable) will be 'stretch' copied in the variable lframe, and then lframe will be copied into a tiny small black bitmap (named 'bit' below) to achieve the 'blackframe' effect. The height and width of lframe must be proportionally the same as the original bitmap. For example let us assume that the thumbnail will be 64 by 64 pixels. The bitmap is 1000 by 600. If the bitmap is simply 'stretch' copied into the 64 by 64 thumbnail it will look stretched out of shape since the orignal bitmap was not square. To prevent this from happening the lframe bitmap is first set to match the proportions of the original bitmap. The original bitmap can then be stretch copied into this tiny frame wihtout distortion and then the frame can be copied onto the 64 by 64 black canvas to achieve the framing effect.

Let us suppose that in the above example the bitmap was 1000 wide and 600 high. The little frame (lframe) into which we wish to copy this bitmap to make a thumbnail would be 64 by 64 but we want the proportions to match since this is not a square bitmap. We can create a mathematical ratio to find the required values for the height and width of lframe. In this case the bitmap is higher than it is wide so we will keep the height in the thumbnail (in this example 64) and then look for the correct width to avoid distortion when stretch copying. 1000 is to 600 as 64 is to the new width. If you remember some high school algebra this can be expressed as a mathematical equation as follows : 1000 / 600 = 64 / x ... where x is the appropriate width for the little thumbnail frame. Cross multiplying expresses this ration using multiplication instead of division, yielding 1000 * x = 64 * 600, and then dividing both sides by 1000 isolates the unknown variable x yielding the equation to solve for the unknown dimension (X = (64 * 600) / 1000... A similar mathematical calculation also gives the new height in the case where the width is greater than the height and we wish to keep the thumbnail 64 pixels wide but wish to find the appropriate height to avoid distortion when stretch copying the larger bitmap into the the little frame.

The two images below show the result (128 x 128 thumbnails) one wider than it is tall and thus framed horizontally, and the other higher than it is wide and thus framed left to right (the framing effect is achieved by copying the proportional lframe thumbnail bitmap onto a black canvas - the bit bitmap in the code below) ...


horizontal_thumb.jpg - 143106 Bytes

vertical_thumb.jpg - 267213 Bytes




function CreateThumbnail:boolean;
var lframe : tbitmap; {thumbnail which will sit in frame}
    destrect : trect;
    sourcerect : trect;
    bit : tbitmap; {the black frame around the thumbnail}
begin
    Result := true;
try
 If bitmap.height <> bitmap.width then begin
    If bitmap.Height > bitmap.width then begin
       lframe.Width := (rect.right * Bitmap.width) div bitmap.height;
       lframe.height := rect.bottom;
       destrect.Left := 0;
       destrect.Top := 0;
       destrect.Right := bit64.width;
       destrect.bottom := bit64.height;
       bit.canvas.brush.Style := bsSolid;
       bit.canvas.brush.Color := clBlack;
       bit.canvas.FillRect(destrect);
       destrect.right := lframe.width;
       destrect.bottom := lframe.height;
       lframe.canvas.StretchDraw(destrect, bitmap);
       destrect.left := (bit.width ­ lframe.width) div 2;
       destrect.Top := 0;
       destrect.Right := destrect.left + lframe.width;
       destrect.bottom := bit.height;
       sourcerect.Left := 0;
       sourcerect.Top := 0;
       sourcerect.right := lframe.width;
       sourcerect.bottom := lframe.height;
       bit.canvas.CopyRect(destrect, lframe.canvas,
                   sourcerect)
    end ;
    If bitmap.Height < bitmap.width then begin
       lframe.height := (rect.bottom * Bitmap.height) div bitmap.width;
       lframe.width := rect.right;
       destrect.Left := 0;
       destrect.Top := 0;
       destrect.Right := bit64.width;
       destrect.bottom := bit64.height;
       bit.canvas.brush.Style := bsSolid;
       bit.canvas.brush.Color := clBlack;
       bit.canvas.FillRect(destrect);
       destrect.right := lframe.width;
       destrect.bottom := lframe.height;
       lframe.canvas.StretchDraw(destrect, bitmap);
       destrect.left := 0;
       destrect.Top := (bit.Height ­ lframe.height) div 2;
       destrect.Right := bit.width;
       destrect.bottom := destrect.top + lframe.height;
       sourcerect.Left := 0;
       sourcerect.Top := 0;
       sourcerect.right := lframe.width;
       sourcerect.bottom := lframe.height;
       bit.canvas.CopyRect(destrect, lframe.canvas,
                   sourcerect);
    end;
end else begin  {square picture}
       destrect.left := 0;
       destrect.top := 0;
       destrect.right := bit.width;
       destrect.bottom := bit.height;
       bit.canvas.StretchDraw(destrect, bitmap);
end;
except
   Result := false;
end;
end;

Delphi Index




A Unified Field Theory

failed_gravity_theory.gif - 10361 Bytes



The Unified Field Theory
is also available as a zip file ->
unified.zip

Introduction :The Pioneer Effect and the New Physics. A brief description of the new physics required to explain the 'Pioneer Effect', which is the constant deceleration of space craft as they fly through space.




Principles of Evolution: A Study in the Evolution of Bedbugs



A couple of years ago my bedroom was invaded by bedbugs. There were two variant genetic lines. One type of bedbug was an enlongated, thin, tubular insect, and the second genetic line was a flat, perfectly circular insect. The result of the cross breeding of these two genetically distinct variants was the production of a bedbug with charcteristics of both, an enlongated, flat bedbug with a central bulge (such that the shape of the bedbug was somewhere between 'long' and 'circular'). The long skinny bedbugs were such strange and unfamiliar looking insects that at first I did not recognize them as being bedbugs, and considered them to be a seperate species of insect. However, as the photographs of bedbugs above indicate, enlongated and skinny bedbugs are not uncommon, and the photographs also show the variants that are produced by genetic combinations that result in an insect somewhere in between 'circular' and 'enlongated'.

Therefore it is my hypothesis that evolution occurs by means of the transfer of dominate genes, with the production of such dominant genes being the product of 'biological algorithms', a genetic software program that brings physical characteristics into harmony with behavior, such that when behavior changes, and a conflict then exists, this acts as a trigger and causes the release of dominant genes. The result is rapid evolution of species. The bedbug is a relatively new insect, not the product of millions of years of evolution but rather an insect that is evolving in real time. The newly emerging dominant form of the insect is the flat, round ciruclar insect, well adapted to living in human bedrooms (it is flat, rather than tubular, thus allowing it to hide in the smallest cracks, living a stealthy lifestyle, and it is round, which gives the insect a maximum storage capacity such that it must endanger itself only a few times a month by emerging to feed.

Other examples of rapid evolution include the development of long legs in an invasive species of toad in Australia. As the toads move into the mountainous regions of Australia, and their behvaior changes, making them 'climbing toads', over the course of just a couple of decades the toads in the highlands have grown long legs specially adapted to climbing. It is worth noting here that the toads are poisonous, and are a successful invasive species because they have no natural predators in Australia, and so it would not be the case that the toads with long legs were 'the fittest survivors', because all the toads are survivors, and therefore predation does not explain the rapid emergence and spread of such well adapted, long legged toads. Once again we see evidence for the existence of biological algorithms and the rapid spread of dominant genes through a population, which once introduced proceed to overwhelm the older genes which are being replaced (making toad long legged and a bed bug round and flat).


A Theological Experiment

My interest in pursuing the Unified Field Theory is spurred on by my need to discover the theoretical explanation of a new form of propulsion (as explained on this page: Why the Unified Field Theory?). The experiment involving the bedbugs came out of nowhere.

I also believe that it is possible to justify theological propositions using experimental methods. If a thing is an objective truth then it can be verified and proven true by means of experimentation. Such a theological proposition is of more value than a ‘divine revelation’, since such revelations depend upon nothing more than establishing authority figures which requires the creation of artificial hierarchies, for the only reason why I might be encouraged to believe an authority figure who orders me to believe unsubstantiated opinions is if I could somehow be convinced that this authority possessed a mind that was somehow superior to mine, and thus was fit to express opinions as though opinions were unquestionable facts and thus worthy of being elevated to the status of absolute dogma.

There is a self evident human inequality which is visibly apparent. Some people are ‘beautiful’ and thus are the true elite on this planet, and some people are not. It is this sexual inequality and the degeneration that follows upon beauty that is the true driving force behind all the evil that happens on earth. The need for ruthless oppression and the pursuit of wealth and the consequent creation of suffering and poverty which must follow upon this practice is for the purpose of creating an artificial alpha elite.

The true elites are the young and the beautiful. The artificial elite are the rich and the wealthy. The elite aging rich artificial alpha male has no good looks, for he is physically degenerate, but he will be found escorting beauty because he has a beautiful wallet. If he loses his wallet he will be found at home with all the other unattractive aged beta males sitting in a rocking chair watching reruns of Bonanza. No money, no sex. It is for this reason that the alpha males are found to be so ruthless and so violent in pursuit of their goal. The alpha male has fallen. The beta male has arisen and now the whole planet is full of ruinous destruction for it.

We see in religion a confused and contradictory reaction to this reality. On the one hand religion preaches a sexless heaven where castration and the clitorectomy create ‘pure spirits’. Muslims throw women under sacks. On the other hand religion supports hierarchy and is the prop of the elite alpha male. It is for this reason that religion is incoherent when it comes to speaking about sex.

Now we see this same principle at work in all of nature. Guppies dance and show off their colorful tails and the guppy who dances with the most colorful tail is the sexually successful guppy. Therefore it is the doctrine of the ruthless oppressor which teaches that the solution to human sexual violence is to be found in castration and the creation of pure ghosts. This would be equivalent to damning an aardvark for having the ‘sinful aardvark nature’ or prosecuting an anteater for the high crime of ‘ant genocide’.

Therefore it was my theological hypothesis that the correct solution to this problem is to give every guppy a beautiful colorful tail. I compare this solution to the classic religious solution which is to cut off every tail since having a tail is ‘sinful’. If having a tail is sinful then God must be sinful for no human being has any choice in deciding whether or not they would be born with a colorful tail, or whether they would not.

When I was young I was a beautiful guppy with a lovely tail. So everyone seemed to think. I am older now. My nose became very badly sunburned and destroyed. It seemed good to me to test my hypothesis by using these ‘biological algorithms’ to correct this problem. I healed half my nose as you can see by the line separating the still very dark patch on the side in the photograph below.





I documented my experiment on these pages. one two t hree four fi ve six


I have confirmed to my own satisfaction that my theological proposition is correct and that religious dogma is erroneous, being based as it was upon nothing more than ‘divine revelation’ which is just a form of opinionated speculation. For the time being I am not continuing this experiment, for I must wait until the weather on this planet improves, and the dark clouds of ruthless oppression break letting a little sun shine come through so that I can show the world the truth about God, by showing people how God goes about giving an old guppy back his beautiful colorful tail.


Until then I will have to sit on the sidelines, while all my scientific breakthroughs are deliberately ignored, while I wonder to myself what ever in the world could be wrong with the human race, because what this all will prove at the end of it all is that there definitely was something wrong with the people on this planet.